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.
Unfortunately, activation email could not send to your email. Please try again.

Enter key behavior in GDBG

Thread ID:

Created:

Updated:

Platform:

Replies:

52397 Nov 28,2006 04:14 AM Nov 28,2006 05:10 AM Windows Forms 1
loading
Tags: GridControl
Borja
Asked On November 28, 2006 04:14 AM

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
Borja

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

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,
Haneef

CONFIRMATION

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.

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.

;