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

setting the cursor in the currentcell on keypress

Thread ID:





77630 Nov 10,2008 11:45 PM UTC Nov 18,2008 06:46 AM UTC WinForms 3
Tags: GridControl
Julie Levy
Asked On November 10, 2008 11:45 PM UTC

I have a gridcontrol with currency cells and i want the user to be able to enter negative numbers (hit the negative sign) without clicking into the cell. I can handle the key press and have the entire cell contents selected by doing a CurrentCell.BeginEdit(). But what i really want is no selection, just the cursor active inside the cell. How can i do this?
We are using version

Rajadurai C [Syncfusion]
Replied On November 13, 2008 11:20 AM UTC

Hi Julie,

Thanks for your interest in Syncfusion products.

This feature can be achieved by means of the following codesnippet in CurrentCellKeyPress event handler.

void gridControl1_CurrentCellKeyPress(object sender, KeyPressEventArgs e)
GridCurrentCell cc = this.gridControl1.CurrentCell;
GridCurrencyTextBoxCellRenderer cb = cc.Renderer as GridCurrencyTextBoxCellRenderer;
if(e.KeyChar == '-')
cc.Renderer.ControlValue = string.Empty;

Please refer the following sample that does the same.


Julie Levy
Replied On November 18, 2008 12:14 AM UTC

Thanks for your response and the sample code.
However, the behavior i need is that the "-" still toggles the sign of the value in the cell, the same as if the user first clicked into the cell and then hit the "-".

I found that the following works:
this.CurrentCell.MoveTo(this.CurrentCell.RowIndex, this.CurrentCell.ColIndex, GridSetCurrentCellOptions.SetFocus)


Rajadurai C [Syncfusion]
Replied On November 18, 2008 06:46 AM UTC

Hi Julie,

Thanks for your update.

Glad to hear that your issue has been solved. Please let us know if you have any further concerns.



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

This page will automatically be redirected to the 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