Imports System.Data.SqlClient Public Class FrmStaff Dim cmd As New SqlCommand Private Sub FrmStaff_Load(sender As Object, e As EventArgs) Handles MyBase.Load Dim conn As New SqlConnection Dim DT1 As New DataTable Dim DT2 As New DataTable Dim DT3 As New DataTable conn.ConnectionString = connstring conn.Open() cmd.Connection = conn Dim sql As String Dim da As New SqlDataAdapter Dim dt As New DataTable Me.MdiParent = FrmMDI If conn.State = ConnectionState.Closed Then conn.ConnectionString = connstring conn.Open() End If sql = "select * from tblstaff order by staff_id" cmd.CommandText = Sql da.SelectCommand = cmd da.Fill(dt) DGV1.DataSource = dt set_grid() conn.Close() End Sub Private Sub set_grid() For x As Integer = 3 To DGV1.Columns.Count - 1 DGV1.Columns(x).Visible = False Next DGV1.RowHeadersWidth = 5 DGV1.Columns(0).Width = 100 End Sub Private Sub DGV1_CellClick(sender As Object, e As DataGridViewCellEventArgs) Handles DGV1.CellClick TextBox1.Text = DGV1.Rows(e.RowIndex).Cells("name").Value.ToString TextBox2.Text = DGV1.Rows(e.RowIndex).Cells("Staff_id").Value TextBox3.Text = DGV1.Rows(e.RowIndex).Cells("pw").Value chkSales.Checked = DGV1.Rows(e.RowIndex).Cells("con1").Value chkOrder.Checked = DGV1.Rows(e.RowIndex).Cells("con2").Value chkOrderControl.Checked = DGV1.Rows(e.RowIndex).Cells("con3").Value chkCFMorder.Checked = DGV1.Rows(e.RowIndex).Cells("con4").Value chkQuation.Checked = DGV1.Rows(e.RowIndex).Cells("con5").Value chkOrderEditRecord.Checked = DGV1.Rows(e.RowIndex).Cells("con6").Value chkOrderRecord.Checked = DGV1.Rows(e.RowIndex).Cells("con7").Value chkShip.Checked = DGV1.Rows(e.RowIndex).Cells("con8").Value chkShipCFM.Checked = DGV1.Rows(e.RowIndex).Cells("con9").Value chkShipPrint.Checked = DGV1.Rows(e.RowIndex).Cells("con10").Value chkShipEdit.Checked = DGV1.Rows(e.RowIndex).Cells("con11").Value chkShipped.Checked = DGV1.Rows(e.RowIndex).Cells("con12").Value chkShippedEditRecord.Checked = DGV1.Rows(e.RowIndex).Cells("con13").Value chkShipped1.Checked = DGV1.Rows(e.RowIndex).Cells("con14").Value chkChemical.Checked = DGV1.Rows(e.RowIndex).Cells("con15").Value chkRecipe.Checked = DGV1.Rows(e.RowIndex).Cells("con16").Value chkLeather.Checked = DGV1.Rows(e.RowIndex).Cells("con17").Value chkRawhide.Checked = DGV1.Rows(e.RowIndex).Cells("con18").Value chkWetblue.Checked = DGV1.Rows(e.RowIndex).Cells("con19").Value chkCrustFinish.Checked = DGV1.Rows(e.RowIndex).Cells("con20").Value chkReport.Checked = DGV1.Rows(e.RowIndex).Cells("con21").Value chkSystem.Checked = DGV1.Rows(e.RowIndex).Cells("con22").Value chkOther.Checked = DGV1.Rows(e.RowIndex).Cells("con23").Value End Sub End Class