Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. Visual Basic
  4. Closing a form

Closing a form

Scheduled Pinned Locked Moved Visual Basic
designquestion
4 Posts 3 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • Z Offline
    Z Offline
    zenithmaximus
    wrote on last edited by
    #1

    Hi all, iam havin a hard time figuring out how can i close a form which calls another form... its like a log in form calling the main form after validating the log in parameters. my code goes like this... dim form2bcalled as new form2bcalled form2bcalled.show() me.close() what happens after this codes is that the entire project close... leading me back to the design state. thanks in advance guys... Cheers. "computers are the lousy actors, and programmers are the playwright..."

    -::maximus::-

    D K 2 Replies Last reply
    0
    • Z zenithmaximus

      Hi all, iam havin a hard time figuring out how can i close a form which calls another form... its like a log in form calling the main form after validating the log in parameters. my code goes like this... dim form2bcalled as new form2bcalled form2bcalled.show() me.close() what happens after this codes is that the entire project close... leading me back to the design state. thanks in advance guys... Cheers. "computers are the lousy actors, and programmers are the playwright..."

      -::maximus::-

      D Offline
      D Offline
      Dave Sexton
      wrote on last edited by
      #2

      Option Strict On
      Module basMain
      Public WithEvents frmParent As New Form1 'project startup form
      Public WithEvents frmLogin As Form2 'login form

      Sub Main()
          'prompt user for login first
      
          frmLogin = New Form2 'create a new instance of the form
          Application.Run(frmLogin)
          Application.Run(frmParent)
      End Sub
      

      End Module

      Z 1 Reply Last reply
      0
      • D Dave Sexton

        Option Strict On
        Module basMain
        Public WithEvents frmParent As New Form1 'project startup form
        Public WithEvents frmLogin As Form2 'login form

        Sub Main()
            'prompt user for login first
        
            frmLogin = New Form2 'create a new instance of the form
            Application.Run(frmLogin)
            Application.Run(frmParent)
        End Sub
        

        End Module

        Z Offline
        Z Offline
        zenithmaximus
        wrote on last edited by
        #3

        owkei... ill try this one... thanks alot

        -::maximus::-

        1 Reply Last reply
        0
        • Z zenithmaximus

          Hi all, iam havin a hard time figuring out how can i close a form which calls another form... its like a log in form calling the main form after validating the log in parameters. my code goes like this... dim form2bcalled as new form2bcalled form2bcalled.show() me.close() what happens after this codes is that the entire project close... leading me back to the design state. thanks in advance guys... Cheers. "computers are the lousy actors, and programmers are the playwright..."

          -::maximus::-

          K Offline
          K Offline
          Keith Malwitz
          wrote on last edited by
          #4

          Also check the projects properties. The "Shutdown Mode" is probably set to "When startup form closes". You can change this to "When last form closes".

          1 Reply Last reply
          0
          Reply
          • Reply as topic
          Log in to reply
          • Oldest to Newest
          • Newest to Oldest
          • Most Votes


          • Login

          • Don't have an account? Register

          • Login or register to search.
          • First post
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • World
          • Users
          • Groups