How to prevent the next row from being highlighted in a datagridview every time you press the enter key?

I am trying to use C # language. I do not know how to do that. Please help me guys ...

Thank...

+3
source share
2 answers

Add an event to the control DataGridView.

private void dataGridView1_KeyDown(object sender, KeyEventArgs e)
{
    if (e.KeyData == Keys.Enter)
    {
        e.Handled = true;
    }
}

This event bypasses unwanted behavior DataGridViewwhen a key is pressed Enter.

+5
source

You can set SelectionModeto CellSelect, and it will select a cell only.

0
source

Source: https://habr.com/ru/post/1755669/


All Articles