Example #1
0
 private void deleteAcctButton_Click(object sender, EventArgs e)
 {
     try
     {
         if (dataGridView1.RowCount > 0)
         {
             if (MessageBox.Show("Are you sure you want to delete?", "Confirm", MessageBoxButtons.YesNo,
                                 MessageBoxIcon.Question) == DialogResult.Yes)
             {
                 foreach (DataGridViewRow row in dataGridView1.SelectedRows)
                 {
                     _pm.UserAccountList.RemoveAt(row.Index);
                     dataGridView1.Rows.RemoveAt(row.Index);
                 }
             }
             _pm.writeXML_file(_pm.activeFilePath);
             _pm.generateDatafromXML(_pm.activeFilePath);
         }
         else
         {
             MessageBox.Show("No Account Selected", "Error Deleting Account");
         }
     }
     catch
     {
         MessageBox.Show("Problem Deleting Account", "Error Deleting Account");
     }
 }