We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. (Last updated on: November 16, 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

Enter key behavior in GDBG

Thread ID:





52397 Nov 28,2006 09:14 AM UTC Nov 28,2006 10:10 AM UTC WinForms 1
Tags: GridControl
Asked On November 28, 2006 09:14 AM UTC

Hi, i'm using a GridDataBoundGrid and a have detected a strange behavior: when i push enter the CurrentCell moves to the right and KeyPress event is fired, the problem is that when KeyPress is executed CurrentCell is already the next cell (the one to the right).

How can i know (inside KeyPress event) that the enter key was actually pressed when in previous cell?

Thak you

Administrator [Syncfusion]
Replied On November 28, 2006 10:10 AM UTC

Hi Borja,

You can handle the CurrentCellKeyDown event and get the EnterKey ColIndex of the grid. Then check the LastKeyDown ColIndex to CurrentCell.ColIndex in CurrentCellKeyPress event. Here is a code snippet to show this.

int iLastKeyDownColIndex = -1;
private void gridDataBoundGrid1_CurrentCellKeyDown(object sender, KeyEventArgs e)
{ iLastKeyDownColIndex = this.gridDataBoundGrid1.CurrentCell.ColIndex;}

private void gridDataBoundGrid1_CurrentCellKeyPress(object sender, KeyPressEventArgs e)
if( (int)e.KeyChar == 13)
if( this.gridDataBoundGrid1.CurrentCell.ColIndex != +iLastKeyDownColIndex)
MessageBox.Show("EnterKey pressed in previous CurrentCell");

Best Regards,


This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Please sign in to access our forum

or the page will be automatically redirected to sign-in page in 10 seconds.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon