how to change the textbox control source property
-
i want to save the text of textbox in a string defined by me. i dont want to access the textbox text by textbox1.Text method. i want to know by which property i can change the by default location of the text. so plz help me as soon as possible
Your question is hard to understand. Are you just asking how to put text from a textbox into your own string? If so, that looks like this:
Dim myString as String = txtMyTextbox.Text
Then you can manipulate the myString value without changing the text currently in the textbox. Is that what you were asking for? Or wait...maybe you mean you want to use the textboxes TextChanged Event. When ever the text inside the box changes it fires. It would look something like this:Private myString as String = "" Private Sub txtMyTextbox_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles txtMyTextbox.TextChanged myString = txtMyTextbox.Text End Sub
-
Your question is hard to understand. Are you just asking how to put text from a textbox into your own string? If so, that looks like this:
Dim myString as String = txtMyTextbox.Text
Then you can manipulate the myString value without changing the text currently in the textbox. Is that what you were asking for? Or wait...maybe you mean you want to use the textboxes TextChanged Event. When ever the text inside the box changes it fires. It would look something like this:Private myString as String = "" Private Sub txtMyTextbox_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles txtMyTextbox.TextChanged myString = txtMyTextbox.Text End Sub
-
no actually i want to chnage the property means when ever i changed a text it should save in a string which is declared by me. means i dont want to get the text from txtMyTextbox.text. i just want to access it directly from my decalred string. ok got it?
Ok. I get it. But there isn't a way to get the text out of a textbox without using the
myTextbox.Text
method. It sounds like the closest way to accomplish it what I mentioned earlier...set your string variable everytime the text in the text box changes by adding code to the textbox object's OnTextChanged event. Like this:Private myString as String = ""
Private Sub txtMyTextbox_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles txtMyTextbox.TextChanged
myString = txtMyTextbox.Text
End Sub