DisplayContact
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:
-
Accepts a DataRow object as an argument.
-
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.