hello

my problem is simple but i cant solve it.
i have textbox in form1 and i want the value in the textbox equeal to the value in label in form2..how can i do it..

my code sample is:

form1.Text1.Text=form2.Label1.Caption

its not working...

anyone can help?

I guess you could put your entire project on here as a .zip file.... the code you have there, I see nothing wrong with. It is perfect.

What do you mean no caption?

i want to input data first in the textbox and automatically connect the inputted data in the label.

*Point Above*

You were assigning the value of the caption to the textbox, not the other way around. You can do this:

dim x
x = 5

you cannot do this:

dim x
5 = x

These are not interchangeable....It only works the first way. So when you put:

form1.text1.text = form2.label1.caption

you are saying (with no exception) "I want text1 to now contain the data stored in label1".

Give this code in Form1 :-

Private Sub Text1_Change()
Form2.Label1 = Text1.Text
End Sub

Comments
thanks...

thanks guys for your ideas and time analyzing my problem in visual basic..
thanks to comatose, arvin2006 and ravi kant..

thanks ravi kant...you have the exact solution to my program..

thanks again guys for all your commments..

This question has already been answered. Start a new discussion instead.