I have form1 and form2.
In Form1 load event I do this:
dim aForm as new Form2
aForm.Show
I have a button in form2. I've tried;
form1.close
but this code doesn't work!
please correct me.
Printable View
I have form1 and form2.
In Form1 load event I do this:
dim aForm as new Form2
aForm.Show
I have a button in form2. I've tried;
form1.close
but this code doesn't work!
please correct me.
does it recognize Form1 from Form2? Like in Form2 when you type Form1. does a list pop up as possible actions to take?
If Form1 is the startup form of your proj , and you used Close() method , it will close the application not the form . Use instead , Hide() or Visible() methods set to False .
In the form1 class , declare a private variable:
Private aForm as Form2
when you want to show form2 use:
aForm = New Form2
aForm .Show
when you want to close the form use:
aForm .Close
Basically, aForm was out of scope, and obvously, in production code, you should use a more descriptive names than 'aForm ' and 'Form2';:)
Instead of
From1.close
try
Unload Form1
lol...it's not VB6 dude , This keyword is no longer used in VB.NETQuote:
Originally posted by MixMaster
Instead of
From1.close
try
Unload Form1