Masih menggunakan form yang sama dengan Tutorial-01 namun dengan adanya Tutorial-02 data pada List sudah bisa di input paling tidak dengan ilustrasi data seperti dibawah ini
Public Class APLIKASI
Inherits System.Windows.Forms.Form
Dim DABARANG As OleDb.OleDbDataAdapter
Private Sub APLIKASI_Activated(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Activated
DABARANG = New OleDb.OleDbDataAdapter("SELECT IDUSER,USERNAME,PASSWORD,AUTHENTIFIKASI" & _
" FROM TABEL_USER_SISTEM", MyKoneksi.KONEKSI_DBMS)
Dim DTBARANG As New DataTable
DTBARANG.Clear()
DABARANG.Fill(DTBARANG)
Me.GRIDUSER.DataSource = DTBARANG
Me.GRIDUSER.ReadOnly = True
End Sub
************************************************************************
Private Sub GRIDUSER_DoubleClick(ByVal sender As Object, ByVal e As System.EventArgs) Handles GRIDUSER.DoubleClick
USER.TxtIDUSER.Text = GRIDUSER.Item(0, GRIDUSER.CurrentRow.Index).Value
USER.TxtUSERNAME.Text = GRIDUSER.Item(1, GRIDUSER.CurrentRow.Index).Value
USER.TxtPASSWORD.Text = GRIDUSER.Item(2, GRIDUSER.CurrentRow.Index).Value
USER.CmbLEVEL.Text = GRIDUSER.Item(3, GRIDUSER.CurrentRow.Index).Value
Me.Hide()
USER.Show()
End Sub
**************************************************************************
Private Sub GRIDUSER_KeyDown(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyEventArgs) Handles GRIDUSER.KeyDown
If e.KeyCode = Keys.Enter Then
USER.TxtIDUSER.Text = GRIDUSER.SelectedCells.Item(0).Value
USER.TxtUSERNAME.Text = GRIDUSER.SelectedCells.Item(1).Value
USER.TxtPASSWORD.Text = GRIDUSER.SelectedCells.Item(2).Value
USER.CmbLEVEL.Text = GRIDUSER.SelectedCells.Item(3).Value
Me.Hide()
USER.Show()
End If
End Sub
End Class
Comments
Post a Comment