Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How do I print carriage returns?

Status
Not open for further replies.

analogduck

Programmer
Jan 10, 2002
12
US
I can't find documentation anywhere on such a simple thing as escape codes (if that's what they are in VB) for printing special characters. I want to be able to include a carriage return (newline) in the blurb of text I am printing in a message box statement. Does anyone know where I can find a listing of all the special characters (newline, ", etc.)? Or, if not specifically how to print a newline?
 
To enter a carriage return, the VB code is &vbCrLf

Hope this helps...

jason
 
To make this:

foo

bar

You do this:

MsgBox("foo" & vbCr & vbCr & "bar")
 
Much appreciated - thank you! But, where do I find this documented? Where can I find a documented list of such special characters? After getting the clue from you two, I was able to locate these and a few other such special symbols in the object browser, but I'm at a loss for finding any others.

Thank you for being a help.


- Will work for foo -
 
When I want to find Ascii character codes, I go into Microsoft Access, use the 'Help' menu, 'Contents And Index' entry then a Help Topics dialog box comes up. Click on the 'Find' tab, then type in 'Character Set'. The results list will show "Character Set(0-127)". Click that and what you get will give you Ascii codes for a lot of characters. Then, in VB you can use the CHR function. CHR(13) will give you a new line in a string.

This has often been a convenient way for me to find what it seems you may be looking for. Hope this helps.
 
The other option, if you want a complete list of Visual Basic constants, is to fire up the MSDN and search on the phrase:

"Visual Basic Constants"

This gives you an index page which lists ALL the VB constants grouped by purpose.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top