2
Reply

Need help on index was outside..

Prince

Prince

Feb 3 2010 9:48 AM
2.7k

this is part of my code ,though the program  run(not really correct
)also have this message "Index was outside the bounds of the array"
using
(StreamReader sr = new StreamReader("Date.txt"))
{
String line;
while
((line = sr.ReadLine()) != null)
{
Date mydate = new Date();
int monthTemp;
int dayTemp;
int yearTemp;
String[] str = line.Split(' ');
Int32.TryParse(str[0], out monthTemp);
mydate.Month = monthTemp;
Int32.TryParse(str[1], out dayTemp);
mydate.Day = dayTemp;
Int32.TryParse(str[2], out yearTemp);
mydate.Year = yearTemp;

Answers (2)