datagridview怎样实现选定一行时某一列自动处于编辑状态(就是有光标闪),如果有数据则数据处于选中状态.

解决方案 »

  1.   

    int rows = -1;
            private void dataGridView1_SelectionChanged(object sender, EventArgs e)
            {
                int r = this.dataGridView1.SelectedRows[0].Index;
                if (r != rows)
                {
                    this.dataGridView1.CurrentCell = this.dataGridView1.Rows[r].Cells[2];
                    this.dataGridView1.BeginEdit(true);
                    rows = r;
                }
            }