single quotes inside vb.net string
I need to display single quote inside a warning message in my application. I am expecting the string to be "Error User name should not have ' character". But application displays as "Error User name should not have \' character". I tried with Chr(39) also but it didnt work.

Santhosh Kumar JayaramanPosted Jun 18, 2012, 9:30 AM
Ya i thought about it, but that would be my last option if i couldnt figure out and fix.
VulpesPosted Jun 18, 2012, 9:10 AM
Santhosh Kumar JayaramanPosted Jun 18, 2012, 8:52 AM
VulpesPosted Jun 18, 2012, 8:39 AM
What kind of project are you writing and how are you displaying the exception string to the user?
Santhosh Kumar JayaramanPosted Jun 18, 2012, 8:31 AM
My actual code is
Else
Throw New Exception("The Following Problem occured:Character ' is Invalid.Please change the name")
End If
If (lastname.Success) Then
Else
Throw New Exception("The Following Problem occured:Character ' is Invalid.Please change the name")
But when i try with console application or someother applications, its working with the above string. But in my project for the above code, its coming \'
VulpesPosted Jun 18, 2012, 8:24 AM
MessageBox.Show("Error User name should not have ' character")
Are you perhaps trying to escape the ' by preceding it with a backslash as you would in C#?
If so, this is unnecessary in VB.NET which doesn't use escape sequences.
Santhosh Kumar JayaramanPosted Jun 18, 2012, 8:16 AM
Nattudurai EswaramurthyPosted Jun 18, 2012, 8:00 AM
Nattudurai EswaramurthyPosted Jun 18, 2012, 7:56 AM