Private Sub Refresh_Grid()
Dim connect As SqlConnection = getDriver()
connect.Open()
Dim sql1 As String = "Select ProductID,ProductName from Product"
Dim da As New SqlDataAdapter(sql1, connect)
Dim ds As New DataSet
da.Fill(ds, "Product")
Dim IDColumn As New DataGridViewComboBoxColumn()
IDColumn.DataPropertyName = "ProductID"
IDColumn.HeaderText = "รหัสสินค้า"
IDColumn.DataSource = ds.Tables("Product")
IDColumn.ValueMember = "ProductID"
IDColumn.DisplayMember = "ProductID"
IDColumn.DisplayIndex = 0
DataGridView1.Columns.Add(IDColumn)
Dim NameColumn As New DataGridViewComboBoxColumn()
NameColumn.DataPropertyName = "ProductName"
NameColumn.HeaderText = "ชื่อสินค้า"
NameColumn.DataSource = ds.Tables("Product")
NameColumn.ValueMember = "ProductID"
NameColumn.DisplayMember = "ProductName"
NameColumn.DisplayIndex = 1
DataGridView1.Columns.Add(NameColumn)
Dim DeColumn As New DataGridViewTextBoxColumn()
DeColumn.DataPropertyName = "Degenerate"
DeColumn.HeaderText = "จำนวนสินค้าที่เสื่อมคุณภาพ"
DeColumn.DisplayIndex = 2
DataGridView1.Columns.Add(DeColumn)
Dim ReColumn As New DataGridViewTextBoxColumn()
ReColumn.DataPropertyName = "Ream"
ReColumn.HeaderText = "จำนวนสินค้าที่เบิกทดแทน"
ReColumn.DisplayIndex = 3
DataGridView1.Columns.Add(ReColumn)
End Sub
Dim dataTable As DataTable = CType(ChargeGridView.DataSource,DataTable)
Dim datarow[] dr = dt.Select("ProductCode='" + columnรหัสสินค้า + "' and ProductName='" + columnชื่อสินค้า + "'")