so, by adding the Return keyword inside my loop, it gives me all the info. for microsoft.
how do i get the info. for dell or sun? when i select that from the combo box.
VB Code:
Do Until sr.Peek() = -1 myObject = New stocks 'Create the new instance. myObject.Company() = sr.ReadLine() 'Read the name from the first line. myObject.Shares = Convert.ToInt32(sr.ReadLine()) 'Read the number of shares from the second line. myObject.PurchasePrice = Convert.ToDecimal(sr.ReadLine()) 'Read the share price from the third line. myObject.PurchaseDate = Date.ParseExact(sr.ReadLine(), "dd/MM/yyyy", Nothing) 'Read the date from the fourth line in the specific format. myObjects.Add(myObject) 'Add the new instance to the collection. Return Loop




Reply With Quote