Private Sub DataGridView1_CellClick(ByVal sender As Object, ByVal e As System.Windows.Forms.DataGridViewCellEventArgs) Handles DataGridView1.CellClick
On Error GoTo duplicate
Dim imb() As Byte = DataGridView1.Rows.Item(e.RowIndex).Cells(3).Value
Dim ims As New MemoryStream(imb)
With DataGridView1
txt1.Text = .Rows.Item(e.RowIndex).Cells(0).Value.ToString
txt2.Text = .Rows.Item(e.RowIndex).Cells(1).Value.ToString
txt3.Text = .Rows.Item(e.RowIndex).Cells(2).Value.ToString
PictureBox2.Image = Image.FromStream(ims)
End With
duplicate:
Exit Sub
End Sub
จะทำให้มัน เป็น If ดายไมคัรบแบบว่าให้กวดสอบที่ DataGridView ว่ามีรูปไม ถ้าไม่มีแล้วเอาปิดส่วน
Dim imb() As Byte = DataGridView1.Rows.Item(e.RowIndex).Cells(3).Value
05.Dim ims As New MemoryStream(imb)
.
.
.
.
.
PictureBox2.Image = Image.FromStream(ims)