Text field on another form

  • Thread starter Thread starter Michael Murschell
  • Start date Start date
M

Michael Murschell

If I have Form1 with a text field called Text1 on it, and I want to put
information into that field from a second Form (Form2) how would I do it?

I would have thought there would have been a way to just type
Form1.Text1.text = "this is a test", but that does not work.

Thank you.
 
Michael Murschell said:
If I have Form1 with a text field called Text1 on it, and I want to
put information into that field from a second Form (Form2) how would
I do it?

I would have thought there would have been a way to just type
Form1.Text1.text = "this is a test", but that does not work.

Hmmm..... where did you declare a variable named Form1?
 
I'm sorry, am I suppose to declare it (a form). It is the form that opens
with the program.
 
* "Michael Murschell said:
If I have Form1 with a text field called Text1 on it, and I want to put
information into that field from a second Form (Form2) how would I do it?

I would have thought there would have been a way to just type
Form1.Text1.text = "this is a test", but that does not work.

If you show the 2nd form using 'foo.ShowDialog(Me)' you can use
something like this:

\\\
DirectCast(Me.Owner, Form1).TextBox1.Text = "Foo"
///
 
Michael Murschell said:
I'm sorry, am I suppose to declare it (a form). It is the form that
opens with the program.

Oh, I see. Pass "Me" (without the quotes) to the second form. Used in the
first Form, it is the reference to itself. The second Form can use the
reference to access the textbox.
 
Back
Top