Hello Everyone,

I'm extremely new to programming in Visual Basic and I have a programming exercise which I need help with.

I have a textbox and a label on a form. The objective of the program is for the label to update with any text typed into the textbox as it is typed. So without buttons or clicks.

My teacher has said that it is a complicated thing but that it can be solved quite easily. I can't imagine he wants wads of code from a firsttimer :) Am I correct in that it has something to do with databinding? Any thoughts on how I can solve this one?

Thanks in advance for any help!

Add a timer, textbox, label...
Make Label dock on the Top
Make the TextBox Dock on Bottom
Change timer Properties to Enable = True
Timer Interval = 1 or 10 or 100 or 1000 (1000 = 1 sec, 1 will be super fast)

Timer Code:

label1.Text = TextBox1.Text

This code means: Label 1 will be the same as textBox1.Character.
I think you got what you mean?

It's not a complicated thing and it does not require databinding. If your teacher says it is a complicated thing then I suggest you take everything he/she says with a grain of salt.

Because this is an assignment I will not give you the code but here is a hint. Every time someone makes a change to the text in the textbox you want to change the label to be the same as the textbox. So you have an event that you want to respond to. It only requires you to write one line of code. Let me know if that helps.

I got it.

Public Class Form1

Private Sub TextBox1_TextChanged(sender As Object, e As EventArgs) Handles TextBox1.TextChanged
    Label1.Text = TextBox1.Text
End Sub

End Class

This worked. I actually tried a variation of this last night before I decided to ask for help and I see now that I had it the wrong way around which is why it wasn't working.

Thanks again.