This document contains code for a login form in Visual Basic. It checks the username and password entered in textboxes against values stored in an Access database. If the username and password match what is in the database, it displays a login successful message and opens a new form. Otherwise, it shows a login failed message and clears the textboxes. It also contains code to set focus to a specific cell when another cell is clicked in a datagridview.
This document contains code for a login form in Visual Basic. It checks the username and password entered in textboxes against values stored in an Access database. If the username and password match what is in the database, it displays a login successful message and opens a new form. Otherwise, it shows a login failed message and clears the textboxes. It also contains code to set focus to a specific cell when another cell is clicked in a datagridview.
This document contains code for a login form in Visual Basic. It checks the username and password entered in textboxes against values stored in an Access database. If the username and password match what is in the database, it displays a login successful message and opens a new form. Otherwise, it shows a login failed message and clears the textboxes. It also contains code to set focus to a specific cell when another cell is clicked in a datagridview.
This document contains code for a login form in Visual Basic. It checks the username and password entered in textboxes against values stored in an Access database. If the username and password match what is in the database, it displays a login successful message and opens a new form. Otherwise, it shows a login failed message and clears the textboxes. It also contains code to set focus to a specific cell when another cell is clicked in a datagridview.
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)
Handles Button1.Click Dim uname As String = "" Dim pword As String Dim username As String = "" Dim pass As String If TextBox1.Text = "" Or TextBox2.Text = "" Then MsgBox("tolong isi ") Else uname = TextBox1.Text pword = TextBox2.Text Dim querry As String = " select password from login where username= '" & uname & "'" Dim dbsource As String = "Provider=Microsoft.ACE.OLEDB.12.0;Data Source=login.accdb" Dim conn = New OleDbConnection(dbsource) Dim cmd As New OleDbCommand(querry, conn) conn.Open() Try pass = cmd.ExecuteScalar().ToString Catch ex As Exception MsgBox("usernametidak ada") End Try If (pword = pass) Then MsgBox("login berhasil") Form.Show() If Form.Visible Then Me.Hide() End If Else MsgBox("login gagal") TextBox1.Clear() TextBox2.Clear() End If End If End Sub Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click Me.Close() End Sub Public Class setfocus_datagridview Private Sub DataGridView1_CellContentClick(ByVal sender As System.Object, ByVal e As System.Windows.Forms.DataGridViewCellEventArgs) If e.ColumnIndex = 0 Then DGV.CurrentCell = DGV(1, DGV.CurrentCell.RowIndex) SendKeys.Send("{UP}") End If End Sub End Class End Sub