I am posting yet once again and cannot seem to find an easy way to convert this. I have tried to get rid of the 2 dimensional array for this method, ExtractData and replace it with using a list but am having no luck. Would you guys be able to give me some examples or ideas I can go off of? Thank you.
private void ExtractData( DateTime dtmDay )
{
// set to selected date in MonthCalendar control
int intChosenDay = dtmDay.Day;
int intFileDay; // day of event from file
int intLineNumbers; // counts lines to skip
m_intNumberOfEvents = 0; // set number of events to 0
// initialize StreamReader to read lines from file
StreamReader objInput =
new StreamReader( "calendar.txt" );
// read first line before entering loop
string strLine = objInput.ReadLine();
// loop through lines in file
while ( objInput.Peek() > -1 &&
m_intNumberOfEvents < 10 )
{
intFileDay = Int32.Parse( strLine ); // extract day
// if event scheduled for specified day,
// store information
if ( intFileDay == intChosenDay )
{
m_strData[ m_intNumberOfEvents, 0 ] = strLine;
m_strData[ m_intNumberOfEvents, 1 ] =
objInput.ReadLine();
m_strData[ m_intNumberOfEvents, 2 ] =
objInput.ReadLine();
m_strData[ m_intNumberOfEvents, 3 ] =
objInput.ReadLine();
m_strData[ m_intNumberOfEvents, 4 ] =
objInput.ReadLine();
m_intNumberOfEvents++;
}
else
{
// skip to next event in file
for ( intLineNumbers = 0; intLineNumbers <= 3;
intLineNumbers++ )
strLine = objInput.ReadLine();
}
// read day of next event in file
strLine = objInput.ReadLine();
} // end while
} // end method ExtractData