소프트웨어 개발(SW Dev)/C#
DataGridView 포커스 이동
flowhistory
2020. 11. 25. 21:23
DataGridView 컨트롤에서 포커스 이동 구현
UP, DN 버튼 클릭시 아래 위로 포커스 이동하도록 하였다.
private void BTN_DOWN_Click(object sender, EventArgs e)
{
int iSelRow = 0;
iSelRow = DataGridView.SelectedCells[0].RowIndex;
if (iSelRow == kryptonDataGridView.Rows.Count - 1) return;
DataGridView.CurrentCell = DataGridView.Rows[iSelRow+1].Cells[0];
}
private void BTN_UP_Click(object sender, EventArgs e)
{
int iSelRow = 0;
iSelRow = DataGridView.SelectedCells[0].RowIndex;
if (iSelRow == 0) return;
DataGridView.CurrentCell = DataGridView.Rows[iSelRow - 1].Cells[0];
}
728x90