コード例 #1
0
        private void btnSelect_Click(object sender, EventArgs e)
        {
            if (cmbCustomers.SelectedValue != null)
            {
                try
                {
                    List <Vehicle> vehList = vehControl.GetCustVehicleList(int.Parse(cmbCustomers.SelectedValue.ToString()));

                    if (vehList.Count == 0)
                    {
                        MessageBox.Show("Customer does not have any vehicles assigned.");
                    }

                    cmbSelect.DataSource    = vehList;
                    cmbSelect.DisplayMember = "vehicleUnique";
                    cmbSelect.ValueMember   = "vehicleID";
                }
                catch (Exception)
                {
                    MessageBox.Show("An error has occured, please try again");
                }
            }
            else
            {
                MessageBox.Show("Please select a vehicle.");
            }
        }
コード例 #2
0
 private void btnSelect_Click(object sender, EventArgs e)
 {
     if (cmbCustomers.SelectedValue != null)
     {
         try
         {
             List <Vehicle> vehList = vehControl.GetCustVehicleList(Convert.ToInt32(cmbCustomers.SelectedValue.ToString()));
             cmbVehicles.DataSource    = vehList;
             cmbVehicles.DisplayMember = "vehicleUnique";
             cmbVehicles.ValueMember   = "VehicleID";
         }
         catch (Exception)
         {
             MessageBox.Show("An error has occured, please try again");
         }
     }
     else
     {
         MessageBox.Show("Please select an owner to view vehicles for.");
     }
 }