Esempio n. 1
0
 /// <summary>
 /// Deletes the selected contact (opens up a confirmation window)
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void btnDelete_Click(object sender, EventArgs e)
 {
     DataGridViewCell currentCell = dgContacts.CurrentCell;
     if (currentCell != null)
     {
         int selectedKey = int.Parse(dgContacts[0, currentCell.OwningRow.Index].Value.ToString()); //retrieves Key cell in the (column, row) coordinates.
         DeleteForm delete = new DeleteForm(selectedKey);
         delete.Show();
     }
     else
         MessageBox.Show("No contact is selected.");
 }
Esempio n. 2
0
 /// <summary>
 /// Deletes the current Contact.
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void deleteToolStripMenuItem_Click(object sender, EventArgs e)
 {
     if (!_isNewContact)
     {
         DeleteForm delete = new DeleteForm(_key);
         delete.Show();
         this.Dispose(true);
     }
     else
         MessageBox.Show("This contact doesn't exist yet.");
 }