4

In Visual Basic,

I have the below code written but I have problem printing it in string format although it is type integer. I am trying to save time by not repeating the same thing for over 30 numbers.

Dim line As Integer
line = 0

Sub DisplayModule(page As Integer, line As Integer)
maxline = 100    
For line = 0 To maxline
Print #page, Spc(6); "Display in String"
Print #page, Spc(8); "{"
Print #page, Spc(10); """line"""
Print #page, Spc(8); "}"
Print #page, Spc(8); "next"
Next
End Sub

Problem - It is displaying :

Display in String
{
 line
}
"next line please"
{
 line
}
.
.

I want it to display like this with "" :

Display in String
{
 "0"
}
"next line please"
{
 "1"
}
.
.

I couldn't find anything similar like this on SO. Thanks for your help.

2 Answers 2

5

Try this

Print #page, Spc(10); chr(34) & line & chr(34)
Sign up to request clarification or add additional context in comments.

2 Comments

@PeterL. My Apologies for the inconvenience caused :P
my pleasure sir - I enjoy that race)
2

Try

Dim line As Integer
line = 0

Sub DisplayModule(page As Integer, line As Integer)
   maxline = 100    
   For line = 0 To maxline
      Print #page, Spc(6); "Display in String"
      Print #page, Spc(8); "{"
      Print #page, Spc(10); """" & line & """"
      Print #page, Spc(8); "}" 
      Print #page, Spc(8); "next"
   Next
End Sub

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.