I'm making a window's application project, and I'm trying to make a login page. First time trying, and I think I'm getting somewhere. Just keep running into a few things. Here is my code:
The problems I run into are:Code:Imports System.Data.OleDb Public Class Form4 Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click Dim msg As String Dim title As String Dim style As MsgBoxStyle Dim response As MsgBoxResult msg = "Do you want to not login?" style = MsgBoxStyle.DefaultButton2 Or _ MsgBoxStyle.Critical Or MsgBoxStyle.YesNo title = "?" response = MsgBox(msg, style, title) If response = MsgBoxResult.Yes Then Me.Close() If response = MsgBoxResult.No Then IDTextBox.Clear() PasswordTextBox.Clear() End If End If End Sub Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click Try Dim na As String Dim ne As String Dim ni As String Dim read As OleDbDataReader Dim cn As New OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;Data Source= ./login.mdb;Jet OLEDB") Dim cmd As OleDbCommand = New OleDbCommand("Select * from login where First_NameTextBox.Text = '" & PasswordTextBox.Text & "' ", cn) cn.Open() read = cmd.ExecuteReader If read.HasRows Then read.Read() na = read("AdminName") ni = read("AdminPass") If (First_NameTextBox.Text = na And PasswordTextBox.Text = ni) Then ne = na Form1.Show() Me.Hide() Else MsgBox("Incorrect Username/Password") First_NameTextBox.Clear() PasswordTextBox.Clear() End If Catch MsgBox("Error logging in, please try again", MsgBoxStyle.Exclamation) End Try End Sub End Class
my textbox.clear isn't clearing. The text stays
when I try debugging the program and enter my first name and password, it gives me the "error logging in, please try again" and I know that test/test is the first name and password :P is there anything you notice that I should do?




Reply With Quote