private void FormPesticideJob_Load(object sender, EventArgs e) { InsertSQL pesticideJob = new InsertSQL(); if (state == "Edit") { textBox1.Text = pjj11.Description; cbPesticide.Text = pjj11.Pesticide_id.ToString(); textBox3.Text = pjj11.Quantity_kg.ToString(); cbSoj.Text = pjj11.SowingJob_id.ToString(); cbFarm.Text = pjj11.Farm_id.ToString(); cbCrop.Text = pjj11.Crop_id.ToString(); cbVehicle.Text = pjj11.Vehicle_id.ToString(); cbEmployee.Text = pjj11.Employee_id.ToString(); dtpStart.Value = pjj11.Date_start; dtpEnd.Value = pjj11.Date_end; TestSQL ts = new TestSQL(); cropLists = ts.GetCropList(); employeeList = ts.GetEmployeeList(); farmLists = ts.GetFarmList(); vehicleList = ts.GetVehicleList(); pesticideList = ts.GetPesticideList(); sowingLists = ts.GetSowingJobList(); employeeList = ts.GetEmployeeList(); SowingJob sj11 = new SowingJob(); foreach (SowingJob sow in sowingLists) { cbSoj.Items.Add(sow.Id); } foreach (Crop crop1 in cropLists) { string showText = crop1.Id + ". " + crop1.Name; cbCrop.Items.Add(showText); } foreach (Pesticide pest in pesticideList) { string showText = pest.Id + ". " + pest.Name; cbVehicle.Items.Add(showText); } foreach (Vehicle vehicle in vehicleList) { string showText = vehicle.Id + ". " + vehicle.Name; cbVehicle.Items.Add(showText); } foreach (Employee employee in employeeList) { if (employee.Admin == false) { string showText = employee.Id + ". " + employee.Username; cbEmployee.Items.Add(showText); } } foreach (Farm farm in farmLists) { string showText = farm.Id + ". " + farm.Description; cbFarm.Items.Add(showText); } } }