VB is an "event-driven" programming system - code is basically executed in response to events raised by user interaction.
In order for the label to keep updating you need to respond to the event that is raised when the user changes the contents of the textbox. Using that single line of code doesn't in any way link the two controls - you need to keep the two in synch manually.
If you double-click on your textbox in the form designer it will open a code window and create a procedure "textbox1_textchanged" which handles the textchanged event of the textbox, so you want to put your code to update the label in there :
Code:Private Sub TextBox1_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TextBox1.TextChanged Label1.Text = TextBox1.Text End Sub




Reply With Quote