我使用datagridview的SelectionChanged事件,让选中的
某行数据可以显示在一些textbox里,但是只要这个事件存在,
datagridview自带的那个点击列名可以排序的功能就无法使用,
总是说"未将对象引用设置到对象的实例。"请问该如何解决
我的事件代码:
 private void dataGridView1_SelectionChanged(object sender, EventArgs e)        {
            textBox2.Text =
this.dataGridView1.Rows[dataGridView1.CurrentRow.Index].Cells[0]
.Value.ToString();
            textBox3.Text =
this.dataGridView1.Rows[dataGridView1.CurrentRow.Index].Cells[1]
.Value.ToString();
            textBox4.Text =
this.dataGridView1.Rows[dataGridView1.CurrentRow.Index].Cells[2]
            textBox5.Text =
this.dataGridView1.Rows[dataGridView1.CurrentRow.Index].Cells[3]
.Value.ToString();
            textBox6.Text =
this.dataGridView1.Rows[dataGridView1.CurrentRow.Index].Cells[4]
.Value.ToString();
        }