Private Sub Dgv1_CellContentClick(ByVal sender As System.Object, ByVal e As System.Windows.Forms.DataGridViewCellEventArgs) Handles Dgv1.CellContentClick
Dim cbcImage As DataGridViewImageColumn
cbcImage = New DataGridViewImageColumn
Dim cmd As OleDbCommand = Nothing
Dim sqlDelete As String = ""
sqlDelete = "DELETE FROM TB_INDATA WHERE ID_IN = '" & Txt_Postid.Text & "'"
If Txt_Postid.Text = "" Then
MessageBox.Show("กรุณากรอกข้อมูล", "คำเตือน", MessageBoxButtons.OK, MessageBoxIcon.Information)
Txt_Postid.Focus()
Exit Sub
ElseIf MessageBox.Show("ทำการลบรหัส" & Txt_Postid.Text & " ชื่อ " & Txt_Postname.Text & " ", "คำยืนยัน", MessageBoxButtons.YesNo, MessageBoxIcon.Question) = Windows.Forms.DialogResult.No Then
Exit Sub
End If
Try
cmd = New OleDbCommand(sqlDelete, OleDbConnection1)
cmd.ExecuteNonQuery()
Catch ex As Exception
MessageBox.Show(ex.Message, "ข้อผิดพลาด", MessageBoxButtons.OK, MessageBoxIcon.Exclamation)
Finally
cleargrid()
ClereAllData()
Showrecord()
End Try
End Sub