From Lokesh, 1 Year ago, written in C#.
This paste will check out in 1 Second.
Embed
  1. /// <summary>
  2. /// When the user selects an item from the combobox,
  3. /// grab the information for that selected item and display it
  4. /// on the form.
  5. /// </summary>
  6. /// <param name="sender"></param>
  7. /// <param name="e"></param>
  8. private void cmbEmployees_SelectedIndexChanged(object sender, EventArgs e)
  9. {
  10.     // Make sure we selected an item.
  11.     if (cmbEmployees.SelectedIndex != -1)
  12.     {
  13.         // Fetch the information that we need from the arraylist.
  14.         string grossEarns = ((EmployeeInfo)cmbEmployees.SelectedItem).GrossEarnings.ToString();
  15.         string lessFWT = ((EmployeeInfo)cmbEmployees.SelectedItem).Taxes.ToString();
  16.         string netEarns = ((EmployeeInfo)cmbEmployees.SelectedItem).NetEarnings.ToString();
  17.  
  18.         // Display the information.
  19.         txtGrossEarnings.Text = grossEarns;
  20.         txtLessFWT.Text = lessFWT;
  21.         txtNetEarnings.Text = netEarns;
  22.  
  23.         // Clear the name, hours and wage as we don't need them here.
  24.         txtName.Text = "";
  25.         txtHrWage.Text = "";
  26.         txtHrWorked.Text = "";
  27.     }
  28. }
  29.