help on forms. loading n calling

dec21st

Active member
Joined
May 14, 2005
Messages
43
Programming Experience
3-5
say i have 2 form, form1 and form2. when i start the app, form1 will load. then when i click a button i want to send a value to form2 and open form2 but i don't want to close form1(it'll be at the back of form1). then when i close form2, i want to send another value to form1 and reload the form.

is it possible?

i tried playing with .show/.hide and .showdialog/.close but i end up keep opening more redundant forms on my taskbar.

help!
 
Last edited:
You can do something like this

From form1

dim frm as form2
frm = new form2
frm.textbox1.text = "Your Value" 'control on form2

then from form2, the same thing
dim frm as form1
frm = new frm1
frm.textbox1.text = "Your Value" 'control on form1

If memory serves, this will NOT 'close' form1
Hope this helps
 
In form1:
VB.NET:
Dim dialogue As New Form2

dialogue.SomePublicProperty = SomeValue

If dialogue.ShowDialog() = DialogResult.OK Then
	SomeValue = dialogue.SomePublicProperty
End If
This will open the child form and deny access to the parent until the child is dismissed. If the user is not allowed to cancel the child form then you can do without checking the return value of ShowDialog. Note that if the user clicks the Close button in the top-right corner of a modal dialogue it returns DialogResult.Cancel.
 
Back
Top