HaPhan HaPhan - 1 year ago 91
Vb.net Question

add " into String variable

As the question state, I need to add the " character into a string variable. Is it possible ?
I tried

... and to my surprise, it says that that key is Oem7. They both share the same key code of 222 ?

So now I'm stuck, and I can't search anything related to that " since godgle filter it out automatically.

I need it since my application have to work with an excel file in which i need to put the " into one of the cell.

Answer Source

Two options:

Dim someString As String = "Hello " & Chr(34) & "World" & Chr(34)
Dim someString2 As String = "Hello ""World"""

Possibly you're worried about Unicode here... but if this is a some unicode character that is only similar to the ascii 34 double-quote, VB.Net has unicode support in the language. Just paste the character into a string literal.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download