Skip to main content

Initialization

The PhoneForm_Load method is the event handler for the PhoneForm Load event. The method does the following:

  1. Invokes the InitConnection method. This method, which you have already coded, initializes the connection to Caché.

  2. Invokes the InitConAdapter method. This method creates the CacheDataAdapter object that connects the data set to the Provider.Contact table in Caché. It is explained on a later page in the tutorial.

  3. Invokes the InitPhoneAdapter method. This method creates the CacheDataAdapter object that connects the data set to the Provider.PhoneNumber table in Caché. It is explained on a later page in the tutorial.

  4. Invokes the InitDataSet method. This method creates the data set that represents the Caché data (both the Contact and PhoneNumber tables) in the .NET client. It is explained on a later page in the tutorial.

  5. Initializes the comboboxes for the Edit Phone Information and Edit Contact Information sections of the form.

  6. Invokes the DisplayTreeView method. This method creates the tree displayed on the left hand side of the form. It is explained on a later page in the tutorial.

Here is the method. Add the body of the method to the PhoneForm_Load stub in PhoneForm.cs.


private void PhoneForm_Load(object sender, System.EventArgs e)
{
  InitConnection();
  InitConAdapter();
  InitPhoneAdapter();
  InitDataSet();
  comboBox1.Items.AddRange(new Object[] { "Business","Personal" });
  comboBox2.Items.AddRange(new Object[] 
                                     { "Business", "Home", "Mobile", "Fax" });
  DisplayTreeView();
}   

FeedbackOpens in a new tab