Good Day, how can i put a username and password in form? in Visual Basic 2008

Edited 2 Years Ago by pritaeas: Moved.

here i am telling the way what i used for it (you can also use predefined forms for this purpose).

just create two label and textboxes and one button .

on button you can now check for login as follow:

if(Txtusername.text="Admin" and Txtpassword.text="Password")
msgbox("login successful")
msgbox("Password Invalid")
End if

right now you should write above code but later (when you understand DB concept) then you can retrieve data from DB and then check for login.

hope this helps.

Edited 2 Years Ago by Learner010

correct answer

what should i do if this happen
If TextBox1.Text = "asdf" Then

            If TextBox2.Text = ("qwerty") Then



        End If

    End If

it doesnt go into form 2? why is it like this?

Here are some alternatives for you,
What you can do is Remove me.close()
go to solution explorer → My Project → on application tab.
you will notice at the bottom: shutdown mode.
change it to "when last from closing". (check the attachment)


nice explanation

the reason is:
When you are using me.close on the form 1
and at the time by default the application setting is as
shutdown mode: When startup form closes.
so When your First form is going to close at the time all else form which are linked with it will closed. So for your situation you can not close it. (you can hide it)

But on the Form 2 Closes you should also need to close first form.
On form2 => formclosing event will be:
or form1.close()

but I will prefered you to change the setting. as shown in previous details.

Reason: You can close any form, but the application will not end untill the last form is opened.

Thank you - Deep Modi

This article has been dead for over six months. Start a new discussion instead.