VB 6 Forms

Discussion in 'Programmer's Corner' started by Mazaag, Feb 14, 2006.

  1. Mazaag

    Thread Starter Senior Member

    Oct 23, 2004
    Hey Guys,
    Quick questions about forms in VB 6.

    I want to have like a login screen for my application ( as a seperate form ), and if the password is correct, it opens another form , and CLOSES the login form.

    With VB 6 , there is like a template "login" page, which I can add into my project.

    My question is , how do I set the function to close the login in form and open the second one when the password is correct ? and is there an order in which the forms are opened when the application is executed? if there is, how do I set it ?

    Thanks Alot guys
  2. n9352527

    AAC Fanatic!

    Oct 14, 2005
    I don't have a copy of VB6 handy, but I know that on project properties (or something similar) dialog you could set which form is first invoked. You could also set a module (function) instead of a form.

    So, either you set the login form as the first form, and invoke the app form after that or you could invoke them from a module.
  3. mickjack

    New Member

    Feb 22, 2006
    create a sub main() in a module
    make this your startup
    design your login form and have a public boolean var called bOK
    (or bLoginSucces or whatever) and one button (btnLogin)
    load this modally in main() ie. frmLogin.show vbmodal

    in frmLogin...
    create a function to check name/password
    and set bOK to true
    in btnLogin_click event....
    me.hide (not me.close)

    in main()
    ....after frmLogin.show vbmodal
    check frmLogin.bOK
    if true then load main form or exit

    Thats all!