开发者

How to prevent in highlighting the next row in datagridview every time you hit enter key?

开发者 https://www.devze.com 2023-01-08 17:35 出处:网络
I\'m trying it in C# language.. I don\'t know how to acc开发者_C百科omplish it. Please help me guys...

I'm trying it in C# language.. I don't know how to acc开发者_C百科omplish it. Please help me guys...

Thanks...


Add an event to the DataGridView control.

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

This event bypasses the undesired behavior of the DataGridView when Enter key is being pressed.


You can set the SelectionMode to CellSelect and it will only select the cell.

0

精彩评论

暂无评论...
验证码 换一张
取 消