1
votes

I have three forms (form1, form2, form3) in a windows application using vb.net

form1 has a button (button1). Onclick of button1, I want to open form2 in such a way that it can also open multiple times. I achieved this with the code below:

Dim myForm As New Form2
myForm.Show()

Now form2 has a button (button2), and a label (label1). Onclick of button2, I want to open a single instance of form3 a dialog, so I have the code below:

form3.showdialog()

form3 has a textbox (textbox1).

My problem is that I want when I fill textbox1, I want the value to appear in label1 of form2 that opened the form3, I tried the code below, but it did not work:

form2.label1.Text = textbox1.Text

I need to update form2 (the last active one) once form3 has been closed Can anybody help me out please?

1
Do you need to have Form2 display the changes, as they are made, while Form3 is still visible, or do you just need to update Form2 once Form3 has been closed?Steven Doggart
So you plan to have multiple instances of Form2, all opening the same instance of Form3? Screenshot could help explain your need.Neolisk
@StevenDoggart : I need to update form2 once form3 has been closed.Toni

1 Answers

1
votes

When you go to show the Form3 as a dialog, you should be able to do:

Dim f3 As New Form3
f3.ShowDialog()
Me.label1.Text = f3.textbox1.Text 'Copy the value out of the dialog