I'm trying to do a login form where userid and password will match the respective textboxes and so that I can go to another form. Here is the code that I used for VB.NET. I know the VB6 code but don't know VB.NET. Here is the code:
Private Sub LoginButton_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles bttnlogin.Click
'Create a Command Object
Dim objCommand As OleDbCommand
Dim objCommand2 As OleDbCommand
'Call user and password
OleDbDataAdapter1.SelectCommand.Parameters("UserId").Value = UserText.Text & "%"
OleDbDataAdapter1.SelectCommand.Parameters("password").Value = PasswordText.Text & "%"
// This part is highlighted and "Object Reference not set to an instance of an object" pops up as error
.Value = UserText.Text And
.Value = PasswordText.Text Then
Dim mainfrm As New Form()
MsgBox("Your Password or Username is incorrect. Please try Again")
The Connection and CommandText I'm using the objects to do.
Can anyone please help me with this? Thanks a lot! I really need the help.
If there is any better way to write a login page, please email me and teach me if you can. I'll really appreciate the help. Thanks