Close a form when opening another

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • rryan2
    New Member
    • Oct 2007
    • 1

    Close a form when opening another

    I am new to this programming stuff, first off, im trying to figure out how to have your initial form close once the user opens the second form. so far all i have is form.show, but that just opens a second form, i want it to close the first form as well. any ideas?
  • Killer42
    Recognized Expert Expert
    • Oct 2006
    • 8429

    #2
    Originally posted by rryan2
    I am new to this programming stuff, first off, im trying to figure out how to have your initial form close once the user opens the second form. so far all i have is form.show, but that just opens a second form, i want it to close the first form as well. any ideas?
    Form2.Show
    Unload Form1
    (or Form1.Hide)

    Comment

    • vdraceil
      New Member
      • Jul 2007
      • 236

      #3
      Originally posted by Killer42
      Form2.Show
      Unload Form1
      (or Form1.Hide)
      this code will load form2 and go on with form2's load event..i dont think it'll unload form1.Its better to unload form1 in form2's load event.

      Comment

      • Killer42
        Recognized Expert Expert
        • Oct 2006
        • 8429

        #4
        Originally posted by vdraceil
        this code will load form2 and go on with form2's load event..i dont think it'll unload form1.Its better to unload form1 in form2's load event.
        It may well go through Form2's Load event before continuing with the code that invoked Form2. I'm not too sure about the exact sequence there. But it will certainly go ahead and do the Unload or Hide straight after that. Unless you show Form2 modally, in which case control won't return to this code until Form2 is unloaded or (I think) hidden.

        Comment

        Working...