You are on page 1of 1

www.konsultasivb.

com
Oleh : Uus Rusmawan Hal - 1 –

Set focus Dalam Datagridview

Coding :

Private Sub DGV_CellEndEdit(ByVal sender As Object, ByVal e As System.Windows.Forms.DataGridViewCellEventArgs) Handles DGV.CellEndEdit If e.ColumnIndex = 0 Then 'KODE Call Koneksi() CMD = New SqlCommand("SELECT * FROM TBLBARANG WHERE KODE_BARANG='" & DGV.Rows(e.RowIndex).Cells(0).Value & "'", CONN) RD = CMD.ExecuteReader RD.Read() If RD.HasRows Then DGV.Rows(e.RowIndex).Cells(1).Value = RD.Item("NAMA_BARANG") DGV.Rows(e.RowIndex).Cells(2).Value = RD.Item("hARGA_jUAL") DGV.CurrentCell = DGV(3, DGV.CurrentCell.RowIndex) SendKeys.Send("{UP}") Else MsgBox("kODE BARANG tidak terdaftar") End If End If