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

Numeric cell editing

Thread ID:





51745 Nov 13,2006 02:55 PM UTC Nov 14,2006 05:47 AM UTC WinForms 1
Tags: GridControl
Sat Sandhu
Asked On November 13, 2006 02:55 PM UTC

I have a cell, type decimal, I want to limit the input to positive numbers only.

I have tried doing this via NumericUpDown cellType, but I get errors if I input decimals in it.
I have also tried listening to key events - so that I could suppress the minus sign - but the only key event that gets fired on the grid or the renderer is KeyPressed (which I cannot suppress).

Any ideas - this is something that should be obvious and easy - but not with Synconfusion!


Administrator [Syncfusion]
Replied On November 14, 2006 05:47 AM UTC

Hi Sat,

You can use the TextBox celltype and handle the KeyPress event to cancel the non-numeric editing . Kindly refer to sample for details

private void gridControl1_CurrentCellKeyPress(object sender, KeyPressEventArgs e)
GridControl grid = sender as GridControl;
GridCurrentCell cc = grid.CurrentCell;
if( e.KeyChar == '.')
if( cc.Renderer.ControlText.IndexOf(".") != -1 )
e.Handled = true;
else if(!char.IsDigit(e.KeyChar))
e.Handled = true;

Sample : http://www.syncfusion.com/Support/user/uploads/gc_7debb28c.zip

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

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