Resolved Need to make VB change textbox to "Textbox1.Text"

jojofromjory

Member
Joined
Sep 3, 2009
Messages
10
Programming Experience
1-3
Hello, I need help with the following thing:
I have a Textbox1 and I'm making a function that adds " at the beginning and " at the end of the textbox when u click a button called Button2.
The code I have is:
VB.NET:
    Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
        TextBox1.Text = (""" + Textbox1.Text + """)
    End Sub
This won't work because there are 3x " and that counts as 1x " in this case, is there a code on how to type the " sign into my textbox automaticly?

Greetz, Jojo
 
Last edited:
You need use two double-quote chars inside the string literal to output such char when you code:
VB.NET:
[SIZE="5"]text = [COLOR="Red"]"[/COLOR][COLOR="Green"]""[/COLOR][COLOR="Red"]"[/COLOR] & whatever[/SIZE]
The red double-quotes in this example is the string value delimiters, the two green double-quotes will produce one char in output... ;)
 
You need use two double-quote chars inside the string literal to output such char when you code:
VB.NET:
[SIZE="5"]text = [COLOR="Red"]"[/COLOR][COLOR="Green"]""[/COLOR][COLOR="Red"]"[/COLOR] & whatever[/SIZE]
The red double-quotes in this example is the string value delimiters, the two green double-quotes will produce one char in output... ;)

Thank you for your help, it works :D

Greetz, Jojo
 

Latest posts

Back
Top