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.

CurrentCellChanging only comes when cell activates (

Thread ID:





34918 Sep 19,2005 04:49 PM Sep 20,2005 05:45 PM Windows Forms 4
Tags: GridControl
Asked On September 19, 2005 04:49 PM

The CurrentCellChanging seems to arrive only when to type in an inactive cell. Once cell activates the event no longer arrives. I''ve observed this even in grid samples where grid events are traced. Is there a way to get a cancelable event on every key-stroke?

Administrator [Syncfusion]
Replied On September 20, 2005 07:27 AM

Hi Mike, CurrentCellchanging,CurrentCellValidateString,CurrentCellKeyPress are fired for each Keystroke not for cell activation. Try CurrentCellValidateString event handler it is fired for each keystroke and it is a cancelable event. Please refer the sample. The sample prevents the user from entering string. It allows only numbers throughout the column two. The line of code e.cancel=true prevents any further action and maintains the focus in the current cell itself till valid value inside the current cell . private void gridControl1_CurrentCellValidateString(object sender, Syncfusion.Windows.Forms.Grid.GridCurrentCellValidateStringEventArgs e) { GridCurrentCell cc = this.gridControl1.CurrentCell; if (cc.ColIndex==2) { double d; if(!double.TryParse(e.Text, System.Globalization.NumberStyles.Integer, null, out d)) { e.Cancel = true; MessageBox.Show("only numbers"); } } } Here is a sample. intvalidation_gc.zip Hope this helps.Let us know if you need more assistance. Best Regards, Jeba.

Administrator [Syncfusion]
Replied On September 20, 2005 11:03 AM

The CurrentCellChanging does not seem to get fired for each key stroke. It only fires for first key stroke while the editor is inactive in the cell. Simpley add this handler to the VirtualGrid samle you ship: private void HandleCellChanging(object sender, System.ComponentModel.CancelEventArgs e) { Console.WriteLine( "Changing" ); }

Administrator [Syncfusion]
Replied On September 20, 2005 11:14 AM

In addition, the CurrentCellValidateString has a strange bahavior for CellType ComboBox: if you set a e.cancel = true, it clears the value. Just set e.Style.CellType = "ComboBox" on line 63 of Form1.cs in the VirtualGrid project and attach the handler to the event.

Replied On September 20, 2005 05:45 PM

Both CurrentCellChanging and CurrentCellValidateString seem to have a problem as stated in prior posts.


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.