I want to select a simple .txt file that contains lines of strings using a FileUpload control. But instead of actually saving the file I want to loop through each line of text a
private void populateListBox()
{
FileUpload fu = FileUpload1;
if (fu.HasFile)
{
StreamReader reader = new StreamReader(fu.FileContent);
do
{
string textLine = reader.ReadLine();
// do your coding
//Loop trough txt file and add lines to ListBox1
} while (reader.Peek() != -1);
reader.Close();
}
}