Click here to Skip to main content
15,891,951 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
I have two forms.
In the first form there is TextBox1
I want get this property from second Form, that calls about click first form.
Thank you
Code on VB.NET
Posted

1 solution

It's difficult to work out exactly what you are trying to do here - your question is not very clear.
So I can't really give you code!

Lets say you have two forms: Form1 and Form2. Form1 has a textbox.

If a button on Form1 opens Form2 and you want to set a value on From2 to the content of the textbox:
1) Either create a Form2 constructor that take a string parameter, and construct it with the string directly,
or
2) Create a string property in Form2 which can accept the value,
2.1) Set the Form2 instance property after your create it and before you call ShowDialog.

If you want a button on Form2 to fetch a value from Form1 then that is a little more complex - ask and I'll tell you.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900