Example #1
0
 /// <summary>
 /// Opens up a detailed window for the contact.
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void btnDetails_Click(object sender, EventArgs e)
 {
     DataGridViewCell currentCell = dgContacts.CurrentCell;
     try
     {
         int contactKey = int.Parse(dgContacts[0, currentCell.OwningRow.Index].Value.ToString()); //retrieves Key cell in the (column, row) coordinates.
         DetailedForm details = new DetailedForm(contactKey);
         details.Show();
     }
     catch (NullReferenceException)
     {
         MessageBox.Show("No contact is selected.");
     }
 }
Example #2
0
 /// <summary>
 /// Adds a new contact (default Personal) to the database, then opens a detailed window to enter data.
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void btnAddContact_Click(object sender, EventArgs e)
 {
     DetailedForm detailedForm = new DetailedForm();
     detailedForm.Show();
 }