Hello, I have a datagrid and I want to delete selected row from that grid. It is working fine upto this. but I want to add some advance functioning with msgbox YES-No buttons. If user select some row and click on delete button, A msgbox with YES/No options appears. If user clicks YES, row should be deleted but if No is clicked then that row should not be deleted.
I have tried it many ways, but failed to achieve goal. Your help on this would be appreciable.. Thanks
Below is the code:
view source
print?
Private Sub btnDeleteSitting_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnDeleteSitting.Click
MsgBox("Are you sure to DELETE?", MsgBoxStyle.Critical + MsgBoxStyle.YesNo, "WARNING")
If MsgBoxResult.Yes
cmd.Connection = Con
Con.Open()
cmd.CommandText = "Delete from tbl_Sittings where (SittingID = N'" & lblSittingID.Text & "')"
cmd.ExecuteNonQuery()
Exit Sub
ElseIf MsgBoxResult.No Then
End If
Con.Close()
End Sub