// sets up the form on load private void frmAddModifySupplier_Load(object sender, EventArgs e) { this.LoadProductComboBox(); // does the fiollowing if its a add if (this.add) { // find the next availble supplierid and suppliercontactid supplierContact.SupplierContactId = SupplierContactsDB.GetNextAvailableID(); txtSCID.Text = supplierContact.SupplierContactId.ToString(); supplierContact.SupplierId = SupplierDB.GetNextAvailableID(); supplier.SupplierId = SupplierDB.GetNextAvailableID(); this.Text = "Add a Supplier"; lblTitle.Text = "Add Supplier Information"; cmbProductBName.SelectedIndex = -1; } //else does this for modify else { this.Text = "Modify a Supplier"; lblTitle.Text = "Modify Supplier Information"; try { supplier = SupplierDB.GetSupplier(supplierContact.SupplierId); productSuppliers = Products_SuppliersDB.GetAllProdSupOnID(supplierContact.SupplierId); this.DisplaySupplier(); this.RedisplayList(); cmbProductBName.SelectedIndex = -1; } catch (Exception ex) { MessageBox.Show(ex.Message, ex.GetType().ToString()); } } }