Advertisement
If you have a new account but are having problems posting or verifying your account, please email us on hello@boards.ie for help. Thanks :)
Hello all! Please ensure that you are posting a new thread or question in the appropriate forum. The Feedback forum is overwhelmed with questions that are having to be moved elsewhere. If you need help to verify your account contact hello@boards.ie

Question about VB

Options
  • 06-02-2002 1:02pm
    #1
    Closed Accounts Posts: 7,230 ✭✭✭


    Ok i'm doing user and password authentication by simply comparing two strings. The way it was thought in a lecture was silly. password=InputBox("enter your pw") stuff like that. What i'm wondering is with InputBox can you hash out (*) what the user enters in the password field so that users behind you cannot see what you type. I know there is a property to do this for a txtbox, i'm just wondering about an inputbox.. cheerrs


Comments

  • Registered Users Posts: 16,413 ✭✭✭✭Trojan


    Don't think there's a property.

    You could try deleting each char as it's input, and writing out a *, bit of a hack though, and won't work when it's a slow machine.

    Al.


  • Closed Accounts Posts: 7,230 ✭✭✭scojones


    that'd be too much work for a little thing like that. Thanks for the help though :) much appreciated


  • Registered Users Posts: 2,781 ✭✭✭amen


    use the mask edit control this will let you do what u want


  • Registered Users Posts: 15,443 ✭✭✭✭bonkey


    You cannot do it with the basic InputBox, because once the inputbox dialog appears, you have no programmatic control until the user returns from it via OK or Cancel.

    The standard approach is to write a simple Login Box form, with all the necessary handling.

    If you want to make it reuseable, then you dont get the form to do anything except accept the input values, and then make them available as properties of the form, as well as info on whether the OK or Cancel buttons were pressed (yes, you can add properties to the form, and even reference them after the form has unloaded without forcing the form to reload).

    Then, get your Sub Main (or whatever) to essentially have code like :
    
    bContinue = false
    bExit = false
    while not bContinue and not bExit
        frmLogin.Show vbModal
        if not frmLogin.CancelPressed then
          sUsername = frmLogin.Username
          sPassword = frmLogin.Password
          bContinue = MyLoginFunction(sUsername, sPassword)
        else
          bExit = true
        end if
    end while      
    
    if bExit then
        'code to exit application here?
    end if
    
    

    At least, thats how I'd do it :)

    jc


  • Closed Accounts Posts: 7,230 ✭✭✭scojones


    thanks jc, i'm looking at that code now :)


  • Advertisement
Advertisement