How do get the content(Text or Numbers) of a text box in a windows form and take it to the next windows form and use it there.
Don_leon
0
Newbie Poster
Recommended Answers
Jump to Postpass the textbox as a parameter which will be used in form2
Form1
form2 form2 = new form2(textBox1.Text) form2.Show();
Then make a new constructor for the other form, with string parameter and assign this parameter to your textbox (form2).
Form2
Form2(string parameter) …
Jump to PostSorry but form2 is incorrect. Put the new constructor where initializecomponent is..
Form2(string parameter) { InitializeComponent(); textBox1.Text = parameter; }
All 5 Replies
AngelicOne
4
Posting Whiz
Don_leon
0
Newbie Poster
AngelicOne
4
Posting Whiz
gauravk_bhanot
0
Newbie Poster
Geekitygeek
480
Nearly a Posting Virtuoso
Be a part of the DaniWeb community
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.