본문 바로가기
소프트웨어 개발(SW Dev)/C#

DataGridView 포커스 이동

by flowhistory 2020. 11. 25.

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

'소프트웨어 개발(SW Dev) > C#' 카테고리의 다른 글

Visual Studio 2019 버전 16.8.2 릴리즈 정보  (0) 2020.11.25
프로그램 실행 경로 확인 방법  (0) 2020.11.25
퍼센트 계산  (0) 2020.11.04
Dispatcher Timer  (0) 2020.07.31
윤년 규칙  (0) 2020.07.01

댓글