Sometimes quotation marks (" ") appear in a string of text. For example:
She said, "You deserve a treat!"
To place quotation marks in a string in your code
[Visual Basic] Private Sub InsertQuote() TextBox1.Text = "She said, ""You deserve a treat!"" " End Sub [C#]
To achieve the same effect, you can use the ASCII character (34) for a quotation mark:
[Visual Basic] Private Sub InsertAscii() TextBox1.Text = "She said, " & Chr(34) & "You deserve a treat!" & Chr(34) End Sub [C#]
You can also define a constant for the character, and use it where needed:
[Visual Basic] Const quote = """" Private Sub QuoteByConstant() TextBox1.Text = "She said, " & quote & "You deserve a treat!" & quote End Sub [C#]
Controlling the Insertion Point in a TextBox Control | Creating a Password Text Box with the TextBox Control | Creating a Read-Only Text Box | Selecting Text Programmatically in the TextBox Control | Viewing Multiple Lines in the TextBox Control| TextBox Control