i have 3 textboxes and 1 submit button :
- Username
- Secret Question
- Secret Answer
when the user inputs their username , the Secret Question automatically appeared in the second textbox , and then put their answer in the third textbox.. just clicking the submit button the system will verifying if the user inputted it correctly and user will directly in the change password part of the form..
my problem is how username and secret answer becomes case sensitive based on what the user registers. and other problems will be stated as follows. :
here's my codes for usernametextbox :
Private Sub TextBox1_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TextBox1.TextChanged
Dim uname As String
Dim rUname As String = ""
uname = Trim(TextBox1.Text)
If TextBox1.TextLength < 20 Then
con = New OleDbConnection("Provider= Microsoft.ACE.oledb.12.0; Data Source=F:\CBFMNHS Enrollment System\CBFMNHS Enrollment System\bin\Debug\Enrollment System.accdb")
Dim ewaaa As String = "Select * from EditAccount where Username = '" & TextBox1.Text & "'"
com = New OleDbCommand(ewaaa, con)
con.Open()
com.ExecuteNonQuery()
rid = com.ExecuteReader
While rid.Read()
rUname = rid.Item("Username")
TextBox4.Text = rid(5)
End While
rid.Read()
If rid.HasRows Then
TextBox4.Text = rid(5)
Else
MsgBox("Wrong username", MsgBoxStyle.Critical, "Warning")
End If
End If
End Sub
the problem with that codes every time i type a letter it shows the prompt.. until the correct username will type correctly.. there's an error : No data exists for the row/column.
but.. i have data in that row..
here's for submit button :
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim upass As String
Dim rPass As String = ""
upass = Trim(TextBox2.Text)
If TextBox1.Text = "" Or TextBox2.Text = "" Then
MsgBox("Complete the form!", MsgBoxStyle.Information)
ElseIf TextBox2.TextLength < 20 Then
con = New OleDbConnection("Provider= Microsoft.ACE.oledb.12.0; Data Source=F:\CBFMNHS Enrollment System\CBFMNHS Enrollment System\bin\Debug\Enrollment System.accdb")
Dim ewaaa As String = "Select * from EditAccount where Secret_Answer = '" & TextBox2.Text & "'"
com = New OleDbCommand(ewaaa, con)
con.Open()
com.ExecuteNonQuery()
rid = com.ExecuteReader
While rid.Read()
rPass = rid.Item("Secret_Answer")
End While
rid.Read()
If rid.HasRows Then
TextBox2.Text = rid(6)
MsgBox("Your Answer is Correct", MsgBoxStyle.Information)
MsgBox("Create your new Password. Make sure it is 8-12 Characters.", MsgBoxStyle.Information)
PasswordTextBox.Enabled = True
TextBox3.Enabled = True
TextBox1.Enabled = False
TextBox2.Enabled = False
Else
MsgBox("Your Answer is Wrong", MsgBoxStyle.Critical, "Warning")
End If
End If
End Sub
same problem with textboxusername , no data exist but there's data save in my database..