Int32 DisplayOrdersbyCustomerID(int CustomerIDFilter) { //this function works to filter the orders by customer id, it accepts one parameter //new instance of the clsOrderCollection clsOrderCollection AllOrders = new clsOrderCollection(); //var to store the count of the record Int32 Count; //var to store CustomerID int CustomerID; //var to store the index Int32 Index = 0; //call the filter by post code method AllOrders.ReportByCustomerID(CustomerIDFilter); //get the count of records found Count = AllOrders.Count; //loop through each record found using the index to point to each record in data table while (Index < Count) { CustomerID = Convert.ToInt32(AllOrders.OrderList[Index].CustomerID); //set up a new object of class list item lstOrders.DataSource = AllOrders.OrderList; //set the text to be displayed lstOrders.DisplayMember = "CustomerID"; //increment the index Index++; } //return the number of records found return(Count); }