954,541 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

Using quotes inside string variable

Hey guys!

I need to use quotes inside a string variable... but I don't know how.
If I simply put double quotes at the start and at the end, the program interprets it as a closed interval, like if every quote is a string.

What can I do? I've searched here, but none of the results seems to be related with VB.net.

Thanks in advance!

RenanLazarotto
Posting Whiz in Training
247 posts since Nov 2010
Reputation Points: 16
Solved Threads: 10
 

ways i know:

Dim strQuote As String = "text"""
result would be text"

Dim strQuote As String = "text" & Chr(34)
retsult would be text"

jlego
Posting Pro
529 posts since Mar 2009
Reputation Points: 31
Solved Threads: 41
 

Nice.

I'll try add Chr(34) at the begin and at the end of the string, will see if it works.

Thanks for the quick response, I'll post here if works (:

RenanLazarotto
Posting Whiz in Training
247 posts since Nov 2010
Reputation Points: 16
Solved Threads: 10
 

ive read before that you can use html encoding. im not sure how that works tho

if the above doesnt work then do a google search for html encoding " vb.net

might help more

jlego
Posting Pro
529 posts since Mar 2009
Reputation Points: 31
Solved Threads: 41
 

Don't need to search, worked perfectly.

Just added & Chr(34) at the end and at the begin:

Argumentos = "a" & " " & NomedoBackup & " " & Chr(34) & Perfil & "\Folder with spaces\" & Chr(34)


Easy solution that I'll never forget. Thank you!

RenanLazarotto
Posting Whiz in Training
247 posts since Nov 2010
Reputation Points: 16
Solved Threads: 10
 

no problem

jlego
Posting Pro
529 posts since Mar 2009
Reputation Points: 31
Solved Threads: 41
 

This question has already been solved

Post: Markdown Syntax: Formatting Help
You