Test.
js is a file, it contain:
Hello
Hello
Hello
Hello
Hello
This is my code:
I want to read the line then add the 4 "Hello" in my checkedlistbox items whenever the application start.
So, i do a for loop to read the line then add into my checkedlistbox items.
StreamReader readtheline = new StreamReader("C:\\Test2.
js");
//Read the first line of text
for (int i = 1; i <= 100; i++)
{
string line2 = readtheline.ReadLine();
checkedListBox1.Items.Add(line2);
}
readtheline.Close();
}
but when i want to compile it, it appear an error message :
An unhandled exception of type 'System.ArgumentNullException' occurred in system.windows.forms.dll
Additional information: Value cannot be null.
the line which highlighted green.
Thnks...