整数を追加するにはどうすればよいですか。目的を表示するためのカウント変数?
int counter = 0;
private void btnDisplay_Click(object sender, EventArgs e)
{
StreamReader myReader = new StreamReader("StudentRecords.txt");
while (myReader.EndOfStream == false)
{
string[] storageArray = myReader.ReadLine().Split('#');
if (storageArray[0] == "S")
{
lstDisplay.Items.Add("");
lstDisplay.Items.Add("Student Name: " + storageArray[1]);
lstDisplay.Items.Add("Student Number: " +storageArray[2]);
lstDisplay.Items.Add("Attendance: " + storageArray[5]);
lstDisplay.Items.Add("Modules: ");
counter++;
}
else if (storageArray[0] == "M")
{
lstDisplay.Items.Add(storageArray[1]);
}
}
//label to be used to display the number of students
lblnoOfStudents. ??
myReader.Close();
}