Option Strict Off
Imports System.Data.Odbc
Public Class frmBantuan

    Sub Tampilkan()
        da = New OdbcDataAdapter(sqlCari, Conn)
        ds = New DataSet
        ds.Clear()
        da.Fill(ds, sda)
        DGV.DataSource = (ds.Tables(sda))
        DGV.ReadOnly = True
        DGV.Columns(0).Width = 100
        DGV.Columns(1).Width = 220
        DGV.GridColor = Color.Blue
        DGV.DefaultCellStyle.ForeColor = Color.Blue
        DGV.RowHeadersDefaultCellStyle.BackColor = Color.DeepPink
        DGV.AlternatingRowsDefaultCellStyle.BackColor = Color.Yellow
        DGV.SelectionMode = DataGridViewSelectionMode.FullRowSelect
        DGV.ColumnHeadersDefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleCenter
        DGV.Columns(0).DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleCenter
    End Sub

    Private Sub FrmBantuan_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        Koneksi()
        cKodeBtn = ""
        cNamaBtn = ""
        Call Tampilkan()
        DGV.Focus()
    End Sub

    Private Sub DGV_CellClick(ByVal sender As Object, ByVal e As System.Windows.Forms.DataGridViewCellEventArgs) Handles DGV.CellClick
        cKodeBtn = DGV.Rows(e.RowIndex).Cells(0).Value
        cNamaBtn = DGV.Rows(e.RowIndex).Cells(1).Value
    End Sub
    Private Sub DGV_CellDoubleClick(ByVal sender As Object, ByVal e As System.Windows.Forms.DataGridViewCellEventArgs) Handles DGV.CellDoubleClick
        cKodeBtn = DGV.Rows(e.RowIndex).Cells(0).Value
        cNamaBtn = DGV.Rows(e.RowIndex).Cells(1).Value
        Me.Close()
    End Sub

    Private Sub DGV_KeyPress(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles DGV.KeyPress
        On Error Resume Next
        If Asc(e.KeyChar) = Keys.Enter Then
            Me.Close()
        End If
    End Sub

End Class