Skip to main content


The DisplayContact method displays a Contact instance's information in the Edit Contact Information section of the GUI. This method is invoked by the event-handler for tree selection events: treeView1_AfterSelect. The method does the following:

  1. Accepts a DataRow object as an argument.

  2. Updates the GUI elements on the Edit Contact Information panel: the two text boxes and the combobox, to display the information contained in the DataRow.

Add the method body to the DisplayContact stub in PhoneForm.cs:

private void DisplayContact(DataRow targetRow)
 txtConId.Text = targetRow["ID"].ToString();
 txtConName.Text = targetRow["Name"].ToString();
 comboBox1.SelectedItem = targetRow["ContactType"];

Note that treeView1_AfterSelect code has been provided.

FeedbackOpens in a new tab