Skip to main content

AddContact

The AddContact method creates a new Contact instance using the data currently displayed on the Edit Contact Information panel. The event handler for the Create button invokes the method. Here are some more details about what AddContact does:

  1. If curContact references a Contact object, it closes the object and then sets the reference to null.

  2. Instantiates a new Contact object.

  3. Invokes the Update method.

Here is the method. Add the body of the method to the AddContact stub in PhoneFormObj.cs.


private void AddContact
{
  if (curContact != null)
  {
    curContact.Close();
    curContact = null;
   }
  curContact = new Contact(cnCache);
  UpdateContact();
}  

FeedbackOpens in a new tab