have question an code for button 1

seanvoth

Well-known member
Joined
Aug 5, 2006
Messages
58
Programming Experience
1-3
VB.NET:
[SIZE=2]
[/SIZE][SIZE=2][COLOR=#0000ff]Private[/COLOR][/SIZE][SIZE=2] [/SIZE][SIZE=2][COLOR=#0000ff]Sub[/COLOR][/SIZE][SIZE=2] Button1_Click([/SIZE][SIZE=2][COLOR=#0000ff]ByVal[/COLOR][/SIZE][SIZE=2] sender [/SIZE][SIZE=2][COLOR=#0000ff]As[/COLOR][/SIZE][SIZE=2] System.Object, [/SIZE][SIZE=2][COLOR=#0000ff]ByVal[/COLOR][/SIZE][SIZE=2] e [/SIZE][SIZE=2][COLOR=#0000ff]As[/COLOR][/SIZE][SIZE=2] System.EventArgs) [/SIZE][SIZE=2][COLOR=#0000ff]Handles[/COLOR][/SIZE][SIZE=2] Button1.Click
[/SIZE][SIZE=2][COLOR=#0000ff][/COLOR][/SIZE] 
[SIZE=2][COLOR=#0000ff]If[/COLOR][/SIZE][SIZE=2] TextBox2.Text.ToLower = "sean" [/SIZE][SIZE=2][COLOR=#0000ff]Then
[/COLOR][/SIZE][SIZE=2]MessageBox.Show("Corret Username")
[/SIZE][SIZE=2][COLOR=#0000ff]Else
[/COLOR][/SIZE][SIZE=2][/SIZE][SIZE=2][COLOR=#008000][/COLOR][/SIZE] 
[SIZE=2][COLOR=#008000]'Prompt the user to enter valid credentials.
[/COLOR][/SIZE][SIZE=2] 
MessageBox.Show("Please enter a valid Username.", _
"Invalid Credentials", _
MessageBoxButtons.OK, _
MessageBoxIcon.Warning)
[/SIZE][SIZE=2][COLOR=#0000ff][/COLOR][/SIZE] 
[SIZE=2][COLOR=#0000ff]End[/COLOR][/SIZE][SIZE=2] [/SIZE][SIZE=2][COLOR=#0000ff]If
[/COLOR][/SIZE][SIZE=2][/SIZE][SIZE=2][COLOR=#0000ff][/COLOR][/SIZE] 
[SIZE=2][COLOR=#0000ff]If[/COLOR][/SIZE][SIZE=2] TextBox1.Text.ToLower = "basic.net" [/SIZE][SIZE=2][COLOR=#0000ff]Then
[/COLOR][/SIZE][SIZE=2] 
MessageBox.Show("Correct password")
[/SIZE][SIZE=2][COLOR=#0000ff]Else
[/COLOR][/SIZE][SIZE=2][/SIZE][SIZE=2][COLOR=#008000]'Prompt the user to enter valid credentials.
[/COLOR][/SIZE][SIZE=2]MessageBox.Show("Please enter a valid password.", _
"Invalid Credentials", _
MessageBoxButtons.OK, _
MessageBoxIcon.Warning)
 
[/SIZE][SIZE=2][/SIZE][SIZE=2][COLOR=#0000ff]End[/COLOR][/SIZE][SIZE=2] [/SIZE][SIZE=2][COLOR=#0000ff]If
[/COLOR][/SIZE]


what i want to do is when i type the right username and password a messagebox will say "welcome" and if one is worng it will not work
 
If condition1 AndAlso condition2 Then
'Success
Else
'Failure
End If


am geting an errors on the
condition1 condition2
y

i went to the code for button 1 and copy and pasted it in the code​
 
If condition1 AndAlso condition2 Then
'Success
Else
'Failure
End If


am geting an errors on the
condition1 condition2
y

i went to the code for button 1 and copy and pasted it in the code​

here's what he's talking about:
VB.NET:
If TextBox1.Text.ToLower = "basic.net" AndAlso TextBox2.Text.ToLower = "sean" Then
  'Success
Else
  'Failed
End If
 
Back
Top