I am reading values from a selected textfile and then displaying them in a textbox present on my Windows.Form. After my whole textfile has been looped through, the last line in my textfile is repeated again and then I receive the error message: "Exception: Index out of array range."
Do you know what I could have done wrong in my loop?
Code:protected void ReadFile() { try { String line = null; using (mStreamReader = File.OpenText(mOpenFileDialog.FileName)) { while ((line = mStreamReader.ReadLine()) != null) { SplitLine(line); ConvertToLong(); } } tbxDisplay.Text = msContents; } catch (Exception e) { MessageBox.Show(e.Message); } }




Reply With Quote
