escape characters in VB? 
Author Message
 escape characters in VB?

Hi all,

Im a newbie in the VB world. How can I insert a newlinecharacter in a
string like C++ "\n" ?
And by the way how do I use the ohter escapecharacters as well?

Regards Frederik



Sun, 28 Mar 2004 00:05:52 GMT  
 escape characters in VB?

Quote:
> Im a newbie in the VB world. How can I insert a newlinecharacter in a
> string like C++ "\n" ?
> And by the way how do I use the ohter escapecharacters as well?

As far as escape characters per se, I'm not sure...but a cheap workaround
for the \n escape character could be:

Dim x As String

x = "hi" & chr(13) & "there"

James



Sun, 28 Mar 2004 00:09:02 GMT  
 escape characters in VB?
I do it with quicly with
    msg = "First Line" & vbCrlF & "Second Line"
You will find vbCrLf in
microsoft.VisualBasic.Constants
Use F2 to display the object brower and expand.
Other useful constants in this context are vbCr, vbTab, vbNullChar,vbLf
Most other entries in Constants are used for other purposes.

You can also define the characters for your self which  is not a good idea
so I won't show you how.

Finally, i have not tried them but there is also
Microsoft.VisualBasic.ControlChars to play with.

Hope this helps

Regards,
AL


Quote:
> Hi all,

> Im a newbie in the VB world. How can I insert a newlinecharacter in a
> string like C++ "\n" ?
> And by the way how do I use the ohter escapecharacters as well?

> Regards Frederik



Sun, 28 Mar 2004 00:22:13 GMT  
 escape characters in VB?
Hi,

Or, use the predefined VB constants.  For example,

MyString & vbCrLf  'new line
MyString & vbTab   'add a tab
'etc.

--
Richard Grier  (Microsoft Visual Basic MVP)
Hard & Software
12962 West Louisiana Avenue
Lakewood, CO  80228
303-986-2179 (voice)
303-986-3143 (fax)
Leave voice mail or fax that I can receive as email at 303-593-9315
Author of Visual Basic Programmer's Guide to Serial Communications, 2nd
Edition ISBN 1-890422-25-8 (355 pages).
For information look on my homepage at http://www.hardandsoftware.net.
Use the Books link to order.  For faster service contact the publisher at
http://www.mabry.com.



Sun, 28 Mar 2004 00:25:09 GMT  
 escape characters in VB?
Hi,

Woops.  This is VB.NET.  In that case,

MyString & ControlChars.CrLf

'etc.

--
Richard Grier  (Microsoft Visual Basic MVP)
Hard & Software
12962 West Louisiana Avenue
Lakewood, CO  80228
303-986-2179 (voice)
303-986-3143 (fax)
Leave voice mail or fax that I can receive as email at 303-593-9315
Author of Visual Basic Programmer's Guide to Serial Communications, 2nd
Edition ISBN 1-890422-25-8 (355 pages).
For information look on my homepage at http://www.hardandsoftware.net.
Use the Books link to order.  For faster service contact the publisher at
http://www.mabry.com.



Sun, 28 Mar 2004 00:29:15 GMT  
 escape characters in VB?
I would Import them first to make it shorter...

Imports ControlChars
MyString & CrLf

--
Jonathan Allen


Quote:
> Hi,

> Woops.  This is VB.NET.  In that case,

> MyString & ControlChars.CrLf

> 'etc.

> --
> Richard Grier  (Microsoft Visual Basic MVP)
> Hard & Software
> 12962 West Louisiana Avenue
> Lakewood, CO  80228
> 303-986-2179 (voice)
> 303-986-3143 (fax)
> Leave voice mail or fax that I can receive as email at 303-593-9315
> Author of Visual Basic Programmer's Guide to Serial Communications, 2nd
> Edition ISBN 1-890422-25-8 (355 pages).
> For information look on my homepage at http://www.hardandsoftware.net.
> Use the Books link to order.  For faster service contact the publisher at
> http://www.mabry.com.



Sun, 28 Mar 2004 01:41:04 GMT  
 escape characters in VB?
Frederik,

Take a look at System.Environment.NewLine.  For other control characters
look at Microsoft.VisualBasic.ControlChars.

-Brian

This post is governed by the Conditions of Use and is provided "AS IS" with
no warranties, and confers no rights. You assume all risk for your use. ?
2001 Microsoft Corporation. All rights reserved.
<http://www.microsoft.com/info/terms.htm>

Please do not send email directly to this alias. This is our online account
name for newsgroup participation only.

--------------------


| Subject: escape characters in VB?
| Date: Tue, 9 Oct 2001 18:05:52 +0200
| Lines: 9
| X-Priority: 3
| X-MSMail-Priority: Normal
| X-Newsreader: Microsoft Outlook Express 6.00.2462.0000
| X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2462.0000

| Newsgroups: microsoft.public.dotnet.languages.vb
| NNTP-Posting-Host: k1-126-ng12-sesto-1.amodo.com 212.209.122.126
| Path: cppssbbsa01.microsoft.com!tkmsftngp01!tkmsftngp03
| Xref: cppssbbsa01.microsoft.com microsoft.public.dotnet.languages.vb:18977
| X-Tomcat-NG: microsoft.public.dotnet.languages.vb
|
| Hi all,
|
| Im a newbie in the VB world. How can I insert a newlinecharacter in a
| string like C++ "\n" ?
| And by the way how do I use the ohter escapecharacters as well?
|
| Regards Frederik
|
|
|



Mon, 29 Mar 2004 00:01:08 GMT  
 
 [ 7 post ] 

 Relevant Pages 

1. Escaping Characters in VB

2. escaping characters in VB?

3. How to Convert Escape Characters from C# to VB.NET

4. Escape sequence in VB Strings (and Characters)

5. Printer escape characters

6. Q. Escape Character For Response.Write

7. Escape Character Problem in ADO

8. Escape '%' character

9. Escape Character Problem in ADO object

10. escaping a doublequote character

11. Quickie:Escape characters etc..

12. escape character?

 

 
Powered by phpBB® Forum Software