Results 1 to 6 of 6

Thread: Closing a form

  1. #1

    Thread Starter
    New Member
    Join Date
    Apr 2003
    Location
    Tacoma, WA
    Posts
    13

    Closing a form

    This one should be simple. All I want to do is click a button to go to a new form and at the same time close the current form.

    As of now, when I click to go to the new form, the old one is still in the background. When I click on the go back button of my second form, it opens a new instance of the first form, thus causing me to have two of the same form1 open.

    Thanks.

  2. #2
    Sleep mode
    Join Date
    Aug 2002
    Location
    RUH
    Posts
    8,083
    Use Me.Close() method to close the current form .

  3. #3

    Thread Starter
    New Member
    Join Date
    Apr 2003
    Location
    Tacoma, WA
    Posts
    13

    didn't work

    The problem with me.close is that it closes the entire application...

  4. #4
    Fanatic Member VBCrazyCoder's Avatar
    Join Date
    Apr 2003
    Posts
    681
    A somewhat sloppy way do handle this would be to pass form1 to form2, and then call form1.Close() in form2's New constructor.

    I am sure there are better ways to handle it, such as MDI, but this might fit your needs.

  5. #5
    Sleep mode
    Join Date
    Aug 2002
    Location
    RUH
    Posts
    8,083
    Me.Close() method closes the application if you use it with the startup form , otherwise I've just tested it , it's working fine . The suggestion VBCrazyCoder mentioned sounds cool though .

  6. #6
    Fanatic Member
    Join Date
    Sep 2002
    Posts
    518
    Why don't you look into Form.Hide and Form.Show?

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