Int32 DisplayOrdersbyOrderStatus(string OrderStatusFilter) { //this function works to filter the orders by order status, 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 OrderStatus string OrderStatus; //var to store the index Int32 Index = 0; //call the filter AllOrders.ReportByOrderStatus(OrderStatusFilter); //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) { OrderStatus = Convert.ToString(AllOrders.OrderList[Index].OrderStatus); //set up a new object of class list item lstOrders.DataSource = AllOrders.OrderList; //set the text to be displayed lstOrders.DisplayMember = "OrderStatus"; //increment the index Index++; } //return the number of records found return(Count); }