Results 1 to 3 of 3

Thread: Proper way to make a login

  1. #1

    Thread Starter
    Junior Member
    Join Date
    Jun 2002
    Posts
    17

    Proper way to make a login

    I am new to VB.net and have a question about the proper method to startup an application.


    I have a user login dialog to load called: frmLogin

    If the user submits the correct user name and password I want it to close the login (frmLogin) and open the main MDI form (frmMain).


    Here's what I have tried so far without success...

    1. Set frmLogin as startup form (displays ok)
    2. Validate the password (works properly)
    3. Then I do the following

    (in the cmdSubmit_click event of frmLogin)

    dim frmMain as new frmMain()
    frmMain.show() (displays main MDI ok)

    me.close() (does not unload the login, but the whole app)


    Can anyone give me some pointers as to the correct method to setup a Login dialog which upon user validation calls a main MDI form and unloads the original login dialog ?


    Thanks for any help...


  2. #2
    Your Ad Here! Edneeis's Avatar
    Join Date
    Feb 2000
    Location
    Moreno Valley, CA (SoCal)
    Posts
    7,339
    Don't have the login form as the startup form. You can show it from within the main form or Sub Main. If you use frmLogin.ShowDialog() then it will show modally if that helps.

  3. #3
    Lively Member
    Join Date
    Jan 2002
    Location
    Malaysia
    Posts
    64
    There is no proper way. It's just a matter of style.

    I personally like using the login as the startup form and have it pass itself as a reference to the MDI form (or other form that is suppose to be loaded after you log in) and then just hide itself (after resetting the username and password values first of course).

    Goes something like this :

    Code:
    'if username and password matches
    
    mdiMain.SetLoginForm(me) 
    'my own sub that accepts a reference of the frmLogin type
    
    me.hide
    So whenever my mdiMain have to go back to the login form i just do this.

    Code:
    _login.Show '_login holds the reference passed in by SetLoginForm
    
    me.dispose 'close the mdiMain

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