By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
428,659 Members | 940 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 428,659 IT Pros & Developers. It's quick & easy.

Text field on another form

P: n/a
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.
Nov 20 '05 #1
Share this Question
Share on Google+
4 Replies


P: n/a
"Michael Murschell" <mm********@gonelco.com> schrieb
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?
--
Armin

http://www.plig.net/nnq/nquote.html
http://www.netmeister.org/news/learn2quote.html

Nov 20 '05 #2

P: n/a
I'm sorry, am I suppose to declare it (a form). It is the form that opens
with the program.

"Armin Zingler" <az*******@freenet.de> wrote in message
news:uk**************@TK2MSFTNGP10.phx.gbl...
"Michael Murschell" <mm********@gonelco.com> schrieb
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?
--
Armin

http://www.plig.net/nnq/nquote.html
http://www.netmeister.org/news/learn2quote.html

Nov 20 '05 #3

P: n/a
* "Michael Murschell" <mm********@gonelco.com> scripsit:
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"
///

--
Herfried K. Wagner [MVP]
<http://www.mvps.org/dotnet>
Nov 20 '05 #4

P: n/a
"Michael Murschell" <mm********@gonelco.com> schrieb
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.
--
Armin

http://www.plig.net/nnq/nquote.html
http://www.netmeister.org/news/learn2quote.html

Nov 20 '05 #5

This discussion thread is closed

Replies have been disabled for this discussion.