事件:DataGridView1_CellEndEdit
DataGridView1.CurrentCell = DataGridView1.Rows(e.RowIndex).Cells(2)
DataGridView1.BeginEdit(True)
我想将第0行第2列的重点放在编辑
上我编辑单元格并输入。 datagridview焦点第0行第2列 我输入它不是焦点第0行第2列 它专注于第1行第2列
此代码无效。
抱歉。我的英语不太好。谢谢。
我编辑单元格并输入:
datagridview焦点第0行第2列:
它关注第1行第2列:
答案 0 :(得分:0)
我从您的问题中了解到,当您按cell
键时,您希望转到datagridview
Enter
的下一个private void dataGridView1_KeyDown(object sender, KeyEventArgs e)
{
try
{
if (e.KeyCode == Keys.Enter)
{
e.SuppressKeyPress = true;
int iColumn = dataGridView1.CurrentCell.ColumnIndex;
int iRow = dataGridView1.CurrentCell.RowIndex;
if (iColumn == dataGridView1.Columns.Count - 1)
dataGridView1.CurrentCell = dataGridView1[0, iRow + 1];
else
dataGridView1.CurrentCell = dataGridView1[iColumn + 1, iRow];
}
}
catch { }
}
private void dataGridView1_CellEndEdit(object sender, DataGridViewCellEventArgs e)
{
if (e.ColumnIndex == dataGridView1.Columns.Count - 1)
{
dataGridView1.CurrentCell = dataGridView1.Rows[dataGridView1.CurrentRow.Index + 1].Cells[0];
}
else
{
SendKeys.Send("{UP}");
SendKeys.Send("{left}");
}
}
。试试这个
\"%{cache-status}e\"