I am receiving an "Object not set to instance of an Object" error when running this code
im pretty sure this error is from this line - string strLine = "";
but I need this line there.......
any idea why this is?
InkedGFX
{ // read the text file if (File.Exists(Application.StartupPath + "[URL="file://\\SugarData.txt"]\\SugarData.txt[/URL]")) { using (StreamReader sr = new StreamReader(Application.StartupPath + "[URL="file://\\SugarData.txt"]\\SugarData.txt[/URL]", false)) { string strLine = ""; // fill the list<string> with the contents of the text file // LVResults.Items.Clear(); while (strLine != null) { char delimeter = (','); strLine = sr.ReadLine(); string[] data = strLine.Split(delimeter); if (strLine != null) { ListViewItem lvi = new ListViewItem(); lvi.Text = data[0]; lvi.SubItems.Add(data[1]); lvi.SubItems.Add(data[2]); lvi.SubItems.Add(data[3]); lvi.SubItems.Add(data[4]); lvi.SubItems.Add(data[5]); LVResults.Items.Add(lvi); LVResults.EndUpdate(); } } } } else MessageBox.Show("No Data to Load!"); }
im pretty sure this error is from this line - string strLine = "";
but I need this line there.......
any idea why this is?
InkedGFX