multiple forms in visual basic 2008

    General discussion

  • Hi everybody

    I have multiple forms, I need to close the current form -without clicking any button- and directly open another form in this project..

    i am using show and close methods but either the 2 forms are appearing together or the current form is not appearing at all .


    please somebody help me it is very urgent



    Saturday, June 25, 2011 10:00 AM

All replies

  • Assuming that Form1 is the form you want to close and Form2 the form you want to open

    If Form1 is not your main form then:


      Dim F As New form2


    And if Form1 is your main form, you have to make form2 your new main form before closing Form1


      Dim F As New form2
      My.Application.ApplicationContext.MainForm = F


    Saturday, June 25, 2011 11:11 AM