-
Adding a login
I want to make a login for my application, not using a database, for now.
I figured something like this:
Code:
Private Sub OK_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles OK.Click
If UsernameTextBox.Text = "Josh" & PasswordTextBox.Text = "mypass1" Then
Me.Hide()
Else If
MsgBox("Sorry User Name Or Passord Is Incorrect")
End If
End Sub
Im getting a cannot convert to boolean or something.
Please help, very new to this. Some Java experience
-
Re: Adding a login
Actually I think i got it.
Code:
Private Sub OK_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles OK.Click
If UsernameTextBox.Text = "Josh" AndAlso PasswordTextBox.Text = "mypass1" Then
MsgBox("Login Successful")
Form1.Show()
Me.Hide()
End If
End Sub
Only one thing:
Doing this only hides the login form. I tried Me.Close() but it closes the whole program.
Is there an IgnoreCase function to make the fields case insensitive
-
Re: Adding a login
Follow the CodeBank link in my signature and check out my WinForms Login thread.
The String.Equals function can be case-sensitive or -insensitive.