Page 1 of 1

VB Escape Character?

Posted: Sat Oct 25, 2008 10:35 am
by Andrew_b
What is the escape character for VB?

I'm using Visual Studio 2008, and when I need to add quotes in a message, it always thinks I'm closing my message.

Here's my code:

Code: Select all

MessageBox.Show("Some one said to me \"Oh Dear\"")
I know this should be simple, but it is not working. :(

Posted: Sat Oct 25, 2008 1:32 pm
by ShadowSpartan
The only way I know of doing it, is using the Chr() function. Here is what the code will look like.

Code: Select all

MessageBox.Show("Someone said to me " & Chr(34) & "Oh Dear" & Chr(34))

Posted: Sat Oct 25, 2008 2:45 pm
by Andrew_b
Yeah, seems the basic languages are a bit too basic. :P

Posted: Sat Oct 25, 2008 2:53 pm
by Domnio
that should work o.O

Damn that's why I stick to C++ lol

where char is simply a key word integer type and not a function lol

Posted: Wed Nov 05, 2008 3:42 pm
by ImpactPro
Escape Character? As in newline? I am not very up on the terms but for C# it is \r\n.

Posted: Wed Nov 05, 2008 10:36 pm
by OwnZ joO
No, escape means it signifies that a special character is coming. For example to have quotes inside of a string you would have to do this:
"A wise man once said \"Something\""
If you don't have the escape character in front of the quotes then it would end the string right after said.

Posted: Thu Nov 06, 2008 4:12 am
by ImpactPro
ah, I see now.