// load data if a SupplierID is passed from Main form private void loadData() { lstProducts.Items.Clear(); List <Suppliers> supplierDetails = new List <Suppliers>(); List <Products_Suppliers> supplierProducts = new List <Products_Suppliers>(); supplierDetails = SuppliersDB.SupplierDetail((int)supId); txtSupplierID.Text = supplierDetails[0].SupplierId.ToString(); txtSupName.Text = supplierDetails[0].SupName.ToString(); supplierProducts = Products_SuppliersDB.SupplierProducts((int)supId); foreach (Products_Suppliers sprod in supplierProducts) { lstProducts.Items.Add(sprod); } }