private void FormFertilisingJob_Load(object sender, EventArgs e) { InsertSQL FertilisingJob = new InsertSQL(); if (state == "Edit") { textBox1.Text = fb11.Description; cbFertiliser.Text = fb11.Fertiliser_id.ToString(); textBox3.Text = fb11.Quantity_kg.ToString(); cbSoj.Text = fb11.SowingJob_id.ToString(); cbFarm.Text = fb11.Farm_id.ToString(); cbCrop.Text = fb11.Crop_id.ToString(); cbVehicle.Text = fb11.Vehicle_id.ToString(); cbEmployee.Text = fb11.Employee_id.ToString(); dtpStart.Text = fb11.Date_start.ToString(); dtpEnd.Text = fb11.Date_end.ToString(); TestSQL ts = new TestSQL(); cropLists = ts.GetCropList(); employeeList = ts.GetEmployeeList(); farmLists = ts.GetFarmList(); vehicleList = ts.GetVehicleList(); fertiliserList = ts.GetFertiliserList(); 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 (Fertiliser fertiliser in fertiliserList) { string showText = fertiliser.Id + ". " + fertiliser.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); } } }