Do I have to write a separate public function to accomplish this? If so how would I go about it. Thanks for all the help.
Printable View
Do I have to write a separate public function to accomplish this? If so how would I go about it. Thanks for all the help.
Sorry forgot to mention this is VB 6, thanks
Did you try to just escape them? Like
"This is a string that reads \"This is a string\""
Dunno if this works in VB, but it's a convention among several other things.
------------------
/earth is 98% full ... please delete anyone you can.
I don't know if this is exactly what you were looking for, but I just wrote a really quick VB6 program where you click on a box and it makes a string (with quotes in it) and then types it in a message box. Here is the code syntax:Quote:
Originally posted by lansdown:
Do I have to write a separate public function to accomplish this? If so how would I go about it. Thanks for all the help.
Private Sub ClickMe_Click()
Dim strTest
strTest = "This is a string with some quotes: "", "", "", "" in it!"
MsgBox (strTest)
End Sub
As you can see, while you are writing the string, double-quotes "" can be used to represent single-quotes. Hope it helps.
------------------
Nick_B
ICQ: 1697810
P4 1.4 GHz
256 Megs PC800 RDRAM
GeForce2 Ultra
Win 2K
Thats close, but what I need to do is put the whole string in quotes. For example the string: "This is a string with some quotes: "", "", "", "" in it!", would actually be in quotes. I know that it is possible to do but I am still not sure how. Thanks for all the help so far.
""That's all u need?""Quote:
Originally posted by lansdown:
Thats close, but what I need to do is put the whole string in quotes. For example the string: "This is a string with some quotes: "", "", "", "" in it!", would actually be in quotes. I know that it is possible to do but I am still not sure how. Thanks for all the help so far.
------------------
I am crab, scoins is crap.
Dim strQuotesQuote:
Originally posted by lansdown:
Thats close, but what I need to do is put the whole string in quotes. For example the string: "This is a string with some quotes: "", "", "", "" in it!", would actually be in quotes. I know that it is possible to do but I am still not sure how. Thanks for all the help so far.
strQuotes = """This string is in quotes"""
The first " starts the string, the second and third make the quote. At the end the double quotes make the quote you see and the final set of quotes ends the string. Ick...that explanation just sounds nasty, but hopefully the example will help enough.
------------------
Nick_B
ICQ: 1697810
P4 1.4 GHz
256 Megs PC800 RDRAM
GeForce2 Ultra
Win 2K
Will VB really figure that out???
In every language I've ever dealt with, ""hello"" will cause a compile error (unrecognized token or something), because the first starts it and the second ends it, so 'hello' is to be interpreted as a variable.
However, I'm pretty sure escaping is universal... e.g. \"text to appear in quotes\" ...with this you can also do:
dim myString As String
String = "\"text in quotes\""
MsgBox(myString)
------------------
I pity da foo
[This message has been edited by praxis (edited April 06, 2001).]
I am using the Microsoft VB 6.0 Development program and it does not allow double quotes within a string. Example strNew = ""String"" : will result in an error message because it doesn't like "" next to each other. I have tried spaces as well between the " but that does not seem to work either. I have read that quotes can be put in a string by using a "Built-In Function" but am not sure how to code it....
Sorry Nick_B I was not looking close enough to notice the """. That seems to work great, thanks tons. I will work on putting that in my code. Again thanks a lot for the help!!!!
Hey guys, Nick_B was right.
I just ran what he suggested, three quotation marks in a row both ending and begining, and it works. Here's my exact code in the Form_Load():
Dim MyVar
MyVar = """Come see me in the Immediate pane."""
Debug.Print MyVar
Like he said, the first quote opens the string. The next two quotes tell VB to output a single quotation mark.
It works. https://www.sharkyforums.com/images/.../2005/08/2.gif
------------------
Baby of Edgewood @ birth (03/09/01, 12:34am)
6 lbs 7 ounces
18 inches long
perfectly healthy
Good to know my little bit of programming knowledge helped somebody :PQuote:
Originally posted by Galen of Edgewood:
Hey guys, Nick_B was right.
I just ran what he suggested, three quotation marks in a row both ending and begining, and it works. Here's my exact code in the Form_Load():
Dim MyVar
MyVar = """Come see me in the Immediate pane."""
Debug.Print MyVar
Like he said, the first quote opens the string. The next two quotes tell VB to output a single quotation mark.
It works. https://www.sharkyforums.com/images/.../2005/08/2.gif
------------------
Nick_B
ICQ: 1697810
P4 1.4 GHz
256 Megs PC800 RDRAM
GeForce2 Ultra
Win 2K
Plugged it into my code and it worked perfectly. Took a little manipulating because I had more then one string, data and user input to incorporate into this, thanks for all the help couldn't have done it without ya.
No problem, glad to help.Quote:
Originally posted by lansdown:
Plugged it into my code and it worked perfectly. Took a little manipulating because I had more then one string, data and user input to incorporate into this, thanks for all the help couldn't have done it without ya.
------------------
Nick_B
ICQ: 1697810
P4 1.4 GHz
256 Megs PC800 RDRAM
GeForce2 Ultra
Win 2K
hurray for the tripple quote.
------------------
www.geocities.com/richardginn/templatehtml -Come visit the Template HTML homepage