Exemple #1
0
 private void btnSearchVehicles_Click(object sender, EventArgs e)
 {
     if (txtVin.Text == "")
     {
         MessageBox.Show("Please enter a VIN to search by.");
     }
     else
     {
         try
         {
             List <Vehicle> vehList = vehControl.GetAllVehicleList(txtVin.Text);
             cmbVehicles.DataSource    = vehList;
             cmbVehicles.DisplayMember = "vehicleUnique";
             cmbVehicles.ValueMember   = "vehicleID";
             if (vehList.Count == 0)
             {
                 MessageBox.Show("There were no results for that VIN.");
                 cmbVehicles.Text = "";
             }
         }
         catch (Exception)
         {
             MessageBox.Show("An error has occured, please try again");
         }
     }
 }
Exemple #2
0
 private void populateVehicleList(string VIN)
 {
     try
     {
         List <Vehicle> vehicleList = vehControl.GetAllVehicleList(VIN);
         if (vehicleList == null || vehicleList.Count == 0)
         {
             MessageBox.Show("There were no results for that search!");
             cmbSelect.Text = null;
         }
         else
         {
             cmbSelect.DataSource    = vehicleList;
             cmbSelect.DisplayMember = "vehicleUnique";
             cmbSelect.ValueMember   = "vehicleID";
         }
     }
     catch (Exception)
     {
         MessageBox.Show("An error occured, please try again.");
     }
 }