Is there a way to close a form through code? I have 5 forms named form1, form2, etc. And I need to close one of them the way you would by clicking on the X, but through code.
Thanks
Printable View
Is there a way to close a form through code? I have 5 forms named form1, form2, etc. And I need to close one of them the way you would by clicking on the X, but through code.
Thanks
Quote:
Originally posted by Dude1
Is there a way to close a form through code? I have 5 forms named form1, form2, etc. And I need to close one of them the way you would by clicking on the X, but through code.
Thanks
well i think i understand you, if not say so, but you go to that form, add a button to it, name it command1, then open the code for that button, and put in between Private Sub Command1_Click() and End Sub put this : Unload Form1.exe (im not sure if the .exe is right, hope fully someone else will post.)
VB Code:
Unload Form1 'this closes the form 'Form1'
Yeh, Unload Form1 works, too bad it didn't solve my real problem. I have a few levels in my game and I made them like subs: Level1, Level2, Level3, etc. Then I have a form on which there are command buttons. So if I click on Button1 then Form1.Level1, Button2 then Form1.Level2. But the problem is that when I finish one level, the second level doesn't reset the positions of objects, even though I say them again.
I'm not too sure what you mean, could you re-phrase what you're trying to do?
Never mind, I got it to work!