CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 5 of 5
  1. #1
    Join Date
    Dec 2003
    Posts
    91

    Two Forms problem

    I am trying to make an MDi app. First of all a login form comes in and asks for username and password, if correct loads the main MDI container form. But I want as soon as the main form is displayed, the login form should be unloaded,
    I use, ( I am using sort of pseudocode)

    if (password and username ) are correct THen
    dim frmMain as new frmMDIFORM
    frmMain.show
    frmLogin.dispose
    else
    Write "Password is Incorrect"
    end if

    Note that frmLogin is my startup form. But when the pw/username are verified, frmLogin terminates the entire app. (doesn't show frmMDIMAIN form)
    HELP

  2. #2
    Join Date
    Oct 2004
    Posts
    152

    Re: Two Forms problem

    is this related to .NET?
    No one does a virgin, life ****s you anyways

  3. #3
    Join Date
    Dec 2003
    Posts
    91

    Re: Two Forms problem

    Ya! I am using Vb.Net

  4. #4
    Join Date
    Oct 2001
    Location
    Melbourne, Australia
    Posts
    576

    Re: Two Forms problem

    It's because you are declaring the form as an object in the login form, so when the login form is unloaded, all it's resources are being freed by the garbage collector - including your instance frmMDIFORM.

    maybe you want to set the frmMDIFORM as the startup form and display the login form modally from the main form so that frmMDIFORM doesn't continue until the login is successfull (or returns that execution needs to be stopped).

  5. #5
    Join Date
    Dec 2003
    Posts
    91

    Re: Two Forms problem

    Thanks Zeb

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

Featured