void DisplayStock() { ClassLibrary.clsStockCollection Stock = new ClassLibrary.clsStockCollection(); ListBoxStock.DataSource = Stock.StockList; ListBoxStock.DataValueField = "StockID"; ListBoxStock.DataTextField = "ItemName"; ListBoxStock.DataBind(); }
void DisplayStock() { //create istance of the stock collection clsStockCollection Stocks = new clsStockCollection(); //set the data source to the list of items in the collection ListBoxStock.DataSource = Stocks.StockList; ////set the name of the primary key ListBoxStock.DataValueField = "StockID"; //set the data field to display ListBoxStock.DataTextField = "Name"; //bind the data to the list ListBoxStock.DataBind(); }