Quotation marks VB.NET

NeonNinja

Neon Resident
Joined
Nov 22, 2009
Messages
26,354
Reaction score
4,358
Location
Neon World
All right, I been reading this library topic here:
http://msdn.microsoft.com/en-us/library/267k4fw5.aspx

n Visual Basic, insert two quotation marks in a row as an embedded quotation mark. In Visual C# and Visual C++, insert the escape sequence \" as an embedded quotation mark. For example, to create the preceding string, use the following code.

Code:
Private Sub InsertQuote()
   TextBox1.Text = "She said, ""You deserve a treat!"" "
End Sub

I get that, my question how do I render this attribute to my entire code? (And not one instance).
 
Do you mean like making it globally access-able? Change Private to Shared? I don't know if I'm understanding your question properly?
 
For example I have dozens of text in this form:
She said to her mother: "I love you!" And her mother replied: "I love you too!" But her sister disagreed and said: "She’s lying!"

Now, problem is, when I ("") double quote the whole sentence to render it a string; this happens:

2r2p269.png


Mind you, I can insert quotation marks one-by-one to correct this like:

m7fl3k.png


Now this becomes inviable if you've got dozens of text to process and quite long sentence structures. So isn't there any easier method of forcing the entire project to adhere to this
rudementary requirement?
 
Last edited:
So basically I want it to read a string according to the first quotation mark and the last quotation mark and be oblivious to what's in between.
 
Last edited:
Does the string start wrapped in "" already or are you trying to wrap each one before building a longer string with them? Are you using variables? cant you just parse the strings one by one adding " to each end before you use them? how are you storing all these strings once you have read them into the application? can you post more code so we can get a better understanding of what is trying to be achieved? in your first picture you are short one "
 
Thanks anyways. rorz0r's solution is impeccable.
Code:
Me.RichTextBox2.LoadFile("C:\Users\Google\Downloads\test.txt", RichTextBoxStreamType.PlainText)

Still studying this VB.NET (yuck) at school, doing a holiday project...
 
Thanks anyways. rorz0r's solution is impeccable.
Code:
Me.RichTextBox2.LoadFile("C:\Users\Google\Downloads\test.txt", RichTextBoxStreamType.PlainText)

Still studying this VB.NET (yuck) at school, doing a holiday project...

No worries.. A little advice.. Use more variables and arrays for data processing. try keep your code out of your form to keep it as reusable as possible. The problem with starting to learn VB.Net is it's to easy pick up bad habits in the beginning, then you have to relearn how to do certain things when you become more adept. Would love to see the final project if you don't mind one day.. peace.
 
This will also be the same:

Private Sub InsertQuote()
TextBox1.Text = "She said, ""You deserve a treat!"" "
' Or
TextBox1.Text = "She said, " & Chr(34) & "You deserve a treat!" & Chr(34)
End Sub
 
Top
Sign up to the MyBroadband newsletter
X