0% found this document useful (0 votes)
17 views

Form1: "" "" "" "" "Tolong Isi "

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.

Uploaded by

alex
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
17 views

Form1: "" "" "" "" "Tolong Isi "

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.

Uploaded by

alex
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
You are on page 1/ 2

Imports System.Data.

OleDb
Imports System.Data
Public Class Form1

Private Property rd As Object

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

Private Function dbsource() As String


Throw New NotImplementedException
End Function

End Class

You might also like