Results 1 to 6 of 6

Thread: Close a form through code?

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    Dec 2001
    Location
    Great White North, ey?
    Posts
    202

    Question Close a form through code?

    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

  2. #2
    Fanatic Member duc's Avatar
    Join Date
    Oct 2002
    Location
    STEAM
    Posts
    702

    Re: Close a form through code?

    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.)

  3. #3
    Not NoteMe SLH's Avatar
    Join Date
    Mar 2002
    Location
    192.168.0.1 Preferred Animal: Penguin Reason for errors: Line#38
    Posts
    3,051
    VB Code:
    1. Unload Form1 'this closes the form 'Form1'
    Quotes:
    "I am getting better then you guys.." NoteMe, on his leet english skills.
    "And I am going to meat her again later on tonight." NoteMe
    "I think you should change your name to QuoteMe" Shaggy Hiker, regarding NoteMe
    "my sweet lord jesus. I've decided never to have breast implants" Tom Gibbons
    Have I helped you? Please Rate my posts.


  4. #4

    Thread Starter
    Addicted Member
    Join Date
    Dec 2001
    Location
    Great White North, ey?
    Posts
    202

    Unhappy

    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.

  5. #5
    Not NoteMe SLH's Avatar
    Join Date
    Mar 2002
    Location
    192.168.0.1 Preferred Animal: Penguin Reason for errors: Line#38
    Posts
    3,051
    I'm not too sure what you mean, could you re-phrase what you're trying to do?
    Quotes:
    "I am getting better then you guys.." NoteMe, on his leet english skills.
    "And I am going to meat her again later on tonight." NoteMe
    "I think you should change your name to QuoteMe" Shaggy Hiker, regarding NoteMe
    "my sweet lord jesus. I've decided never to have breast implants" Tom Gibbons
    Have I helped you? Please Rate my posts.


  6. #6

    Thread Starter
    Addicted Member
    Join Date
    Dec 2001
    Location
    Great White North, ey?
    Posts
    202

    Cool

    Never mind, I got it to work!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width