Exemplo n.º 1
0
 private void lbxDisplay_SelectedValueChanged(object sender, EventArgs e)     // Event for selecting an item on the list
 {
     if (lbxDisplay.SelectedIndex >= 0)                                       // Confirmation that one of the items is actually selected
     {
         string[] listArray = lbxDisplay.SelectedItem.ToString().Split('\t'); // Thanks to: https://stackoverflow.com/questions/2797647/separate-string-by-tab-characters
         txtFirstName.Text = listArray[0];
         txtLastName.Text  = listArray[1];
         txtPhone.Text     = listArray[2];
         // Store the index of the item in the customerdb list by confirming that the objects first name matches that of the first name stored in indices "0" of the array
         listIndex = CustomerDB.FindIndex(customer => customer.FName.Equals(listArray[0], StringComparison.OrdinalIgnoreCase));
     }
     else
     {
         // If no items are selected do nothing...
     }
 }