|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
Easy VB Question
Hello,
I'm trying to assign a string such as "Hello World" to a variable. The trick is, is that I also want to include the quotes around the string. How can this be done in VB? I know in C/C++/Java, you just use escape characters so you can make an assignment like "\"Hello World\"" How do you do that in VB? Thank-you |
|
#2
|
||||
|
||||
|
Just drawing on my old experience with BASIC -- I have made a few half-hearted stabs at VB, only to be frustrated by the development environment and and end up home-sick for the expressiveness of C++.
We used to be able to use either single quotes or double quotes to create a string literal. You could try (spaces inserted to separate the quote marks): ' "Hello, World" ' If that doesn't work, then you could try doubling the quotemarks: ""Hello, World"" (" "Hello, World" ") |
|
#3
|
||||
|
||||
|
double the double qoutes is how u escape it in VB
so x = """Hello World""" should do or use the chr() function but I am not sure exactly what was the number for qoute but assuming it is y x = chr(y) & "Hello World" & chr(y) |
![]() |
| Viewing: Dev Shed Forums > Programming Languages - More > Visual Basic Programming > Easy VB Question |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|