jeudi 29 novembre 2018

In C#, implement a check box to control the display of a message box when deleting a record from database

I am having trouble implementing a check box that when checked will make a message box pop up when the user is trying to delete a record. When the check box is unchecked, the message box will not pop up and the record will be deleted right away.

Here is what I have currently without the checkbox implementation.

private void deleteButton_Click(object sender, EventArgs e)
{
    try
    {
      int index = dataGridViewClients.CurrentRow.Index;
      if(MessageBox.Show("Do you want to delete record?", "Message", 
         MessageBoxButtons.YesNo)==DialogResult.Yes){
         ClientValidation.DeleteClient(clientVM.Clients[index]);
         }
     }
}

I am unsure how to put in the check box control within the method Any help is appreciated.




Aucun commentaire:

Enregistrer un commentaire