hi why does this prompt a wrong pass? plss help. :(

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click

        If TextBox1.Text = "Username" And TextBox2.Text = "Password Then" Then


        Me.Hide()
        Form2.Show()
    Else
        MsgBox("Wrong Username of Password.", vbExclamation, "Wrong")
    End If

Recommended Answers

All 2 Replies

In Textbox2.text you have "Password Then" maybe it should only be "Password" , jsut guessing

this language is case sensitive,
so if you mispelled then it would be the one of the reason.

You may be mispelled here: Textbox1: "username" acyually "Username"
or on password: "password" instead of "Password then" or some here like this.
i thing by mistaken you haven't close the brackets and type the code and on hhint the VB.net complete your code so it becomes:
password then instead of password.

I used same coding example:

If Not textbox1.text = "username" and textbox2.text = "password" then
    messagebox.show("Oops, you have mispelled.")
Else
    Form2.show()
    me.close
End If
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.