VB multi-logon screen

Discussion in 'Software' started by stiched, Apr 23, 2006.

  1. stiched

    stiched Private First Class

    hi, ive been given a small project to create a multi-account logon screen using visual basic. i have to use a text file to store the login names and passwords. for example i believe i could store the following information in the text file...

    john smith,password
    joe bloggs,banana
    peter piper,pass

    (the second parts are the passwords i would like to e given to the name next to it)

    i know that using text files is not the best way of storing login names as passwords and i will ask for more appropriate way afterwards.

    what i would like is for the VB program to load a form named login and if the password is correct then form2.show.

    i will also need 2 text boxes, 1 for a name and one for a password and also a command button.

    if anyone could show me some code to do this sort of thing it would be so great. im not sure how to use the file to match up the name and passwords

    thankz, i know its simple but im new to this stuff
     
  2. foogoo

    foogoo Major "foogoo" Geek

    Try this link there are several results that sound like what your trying to do
     
  3. mastermosley

    mastermosley Sergeant

    Probly be much better if you used a database but neways.

    Here something of what i would do:

    Dim strUsername1
    Dim strPassword1
    Dim strUsername2
    Dim strPassword2

    Private sub Form_Load()
    Open App.path & "\passwords.dat" for input as #1
    Input #1, strUsername1, strPassword1, strUsername2, strPassword2
    Close #1
    End sub

    Private sub cmdLogin_Click()
    if txtUsername.text = strUsername1 and txtPassword.text = strPassword1 then
    'What ever you want to do if its user one
    form1.hide
    form2.show
    else
    form1.hide
    form2.show
    end sub

    I can't really understand what you are making but to check to see what account it would be you can use if statements. Also please add some more info if this is not nuf help fur ya.
     
  4. stiched

    stiched Private First Class

    yea sorry that is pretty much all i wanted to know, getting used to files is probs the hardest thing ive done in VB so far, any idea what i should move onto next?
     
  5. mastermosley

    mastermosley Sergeant

    Well what have you learned? Database programming was a toughy for me...I still haven't learned how to use it with sql but that is defenitally something you might want to learn. You can get a book; 'Database Programming with VB' or just go on google and search for vb6 ado.
     
  6. aianrnoens

    aianrnoens Private E-2

    Here is an example that I wrote using ado database objects.

    I commented all the lines so you will be able to understand it.

    Hope this helps!!!
     

    Attached Files:


MajorGeeks.Com Menu

Downloads All In One Tweaks \ Android \ Anti-Malware \ Anti-Virus \ Appearance \ Backup \ Browsers \ CD\DVD\Blu-Ray \ Covert Ops \ Drive Utilities \ Drivers \ Graphics \ Internet Tools \ Multimedia \ Networking \ Office Tools \ PC Games \ System Tools \ Mac/Apple/Ipad Downloads

Other News: Top Downloads \ News (Tech) \ Off Base (Other Websites News) \ Way Off Base (Offbeat Stories and Pics)

Social: Facebook \ YouTube \ Twitter \ Tumblr \ Pintrest \ RSS Feeds