Int32 DisplayStock() { //create an instance of the stock collection clsStockCollection MyList = new clsStockCollection(); //find all staff MyList.FindAllStock(); //set the data source of the list box lstStockList.DataSource = MyList.AllStock; //set the text to be displayed lstStockList.DisplayMember = "AllDetails"; //set the primary key value lstStockList.ValueMember = "ItemNo"; //return the count of records in the list return(MyList.Count); }