S
Snuyt
Hallo,
I have 3 forms : main, form1 and form2
I can open form1 and form2 from main by clicking a button in main.
I can open form2 form form1 by clicking a button in form1.
I can open form1 from form2 by clicking a button in form2.
However, when I open form1 and form2 from main, and then open form1 from
form2, then I get 2 form1's. This is logical because I made new objects.
But how can I prevent this? Which code should I use for loading forms,
and if they already exist, just focussing on that form?
code in the buttons:
Private Sub button_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles button.Click
Dim f As form1 'the form to open
f=new form1()
f.Show()
End Sub
Thanks,
Snuyt
I have 3 forms : main, form1 and form2
I can open form1 and form2 from main by clicking a button in main.
I can open form2 form form1 by clicking a button in form1.
I can open form1 from form2 by clicking a button in form2.
However, when I open form1 and form2 from main, and then open form1 from
form2, then I get 2 form1's. This is logical because I made new objects.
But how can I prevent this? Which code should I use for loading forms,
and if they already exist, just focussing on that form?
code in the buttons:
Private Sub button_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles button.Click
Dim f As form1 'the form to open
f=new form1()
f.Show()
End Sub
Thanks,
Snuyt