Superman42

Ok say I had a Login form, and I wanted that form to have 1 Username+Password. How would I do that

Say I wanted the Username to be "Superman"

And I wanted the Password to be "123456"

How would I do this

- Thanks from Superman42


Re: Visual Basic General Form Password Help

Dave Patricio

Hi superman32,

you want this username/password to be imbedded in your form or do you want to read from a database


here's a quick example.

let's say you have two textboxes, txtUsername and txtPassword. you also have defined imbedded username and password variables, Username and Password.

on the event of your clicking the OK or Login button on your form, just use a nested if statement.

'to check the username
if (txtUsername.text == Username) then
 
    'to check the password
    if (txtPassword.text == Password) then
        'do something to signify successful login here
    else
       Messagebox.show("Invalid password")
    end if

else
    Messagebox.Show("Invalid username")
end if

happy coding!
dave.




Re: Visual Basic General Form Password Help

Vimal_Rupera

Hi Dave

I have also a same login form where i have two textboxes TXTNAME and TXTPASSWORD. I will enter username and password in them.

now i want this username/password to be read(chekc / validate) from a database(SQL Server). if the values of my textboxes meet my database > table > fileds value, it will let me login in. my Database name is VIMAL and table name is USER containing three fields USERID,USERPWD.

Can you please tell me the codelines for that.....

Thank you

Vimal






Re: Visual Basic General Form Password Help

Dave Patricio

Hey Vimal,

here's a thread with the same solution to your question.

http://forums.microsoft.com/MSDN/showpost.aspx postid=1122749&siteid=1

happy coding!
dave.