nigel drakes

nigel drakes

  • NA
  • 10
  • 0

IndexOutOfRangeException exception is thrown

Jul 5 2010 1:41 PM

I keep getting this error I can not figure out why
 IndexOutOfRangeException exception is thrown 
Here is the code can someone help
using
System;
using
System.Collections.Generic;
using
System.ComponentModel;
using
System.Data;
using
System.Drawing;
using
System.Linq;
using
System.Text;
using
System.Windows.Forms;
using
System.IO;
namespace
WindowsFormsApplication19
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void button1_Click(object sender, EventArgs e)
{
string line;
string[] row = new String[3];

StreamReader file = new StreamReader("c:\\dell\\first.txt");
while ((line = file.ReadLine()) != null)
{
row = line.Split(
',');
textBox2.Text += (row[1]);
textBox3.Text += (row[2]);

}
file.Close();
}
}
}

Answers (3)