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

How do I set a column in child table to ignore non-numeric characters while a user is entering data?

Thread ID:





43876 May 5,2006 08:04 PM UTC May 9,2006 06:44 PM UTC WinForms 4
Tags: GridControl
Steve Killingsworthnolongercoding.NET
Asked On May 5, 2006 08:04 PM UTC

In a Grid Grouping Control, How do I set a column in child table to ignore non-numeric characters while a user is entering data? I am developing in VB.Net. The column I need to make numeric only is defined as a TextBox.

Administrator [Syncfusion]
Replied On May 6, 2006 11:55 PM UTC

Hi Steve, You can acheive this by handling the TableControlCurrentCellValidateString event and canceling it for a non-numeric entry. Please refer this code snippet: AddHandler gridGroupingControl1.TableControlCurrentCellValidateString, AddressOf Grid_CurrentCellValidateString Private Sub Grid_CurrentCellValidateString(ByVal sender As Object, ByVal e As GridTableControlCurrentCellValidateStringEventArgs) ''Get the CurrentCell Dim cc As GridCurrentCell = Me.gridGroupingControl1.TableControl.GetNestedCurrentCell() ''Get the Style Dim style As GridTableCellStyleInfo = CType(e.TableControl.GetViewStyleInfo(cc.RowIndex, cc.ColIndex), GridTableCellStyleInfo) ''Check for the ChildTable If (style.TableCellIdentity.Column.TableDescriptor.ToString() = "MyChildTable") Then ''Check for the Column name in the Table If (style.TableCellIdentity.Column.Name = "Name") Then '' Accept only decimal digits Dim c As Char For Each c In e.Inner.Text If (Char.IsDigit(c) = False) Then e.Inner.Cancel = True End If Next End If End If End Sub Attached is the modified Grid.Grouping.Windows\Samples\ManualRelations sample that handles this for the childtable''s "Name" column. Best regards, Jay ManualRelations_VB.zip

Steve Killingsworthnolongercoding.NET
Replied On May 8, 2006 03:08 PM UTC

Thanks for your reply...I am having problems with the following line of your code snipet: AddHandler gridGroupingControl1.TableControlCurrentCellValidateString, AddressOf Grid_CurrentCellValidateString vb.Net gives a syntax error with AddHandler. Is there something I need to do to get this to work?

Administrator [Syncfusion]
Replied On May 8, 2006 09:37 PM UTC

Hi Steve, It just associates the event (TableControlCurrentCellValidateString) with the eventhandler (Grid_CurrentCellValidateString): http://msdn2.microsoft.com/en-us/library/7taxzxka.aspx Please make sure that the handler signature is correct: Private Sub Grid_CurrentCellValidateString(ByVal sender As Object, ByVal e As GridTableControlCurrentCellValidateStringEventArgs I could able to compile the sample without any issues. You can also subscribe to the event as you normally do (http://www.syncfusion.com/support/kb/studio/Default.aspx?ToDo=view&questId=7) and add the above code to the eventhandler method. Best regards, Jay

Administrator [Syncfusion]
Replied On May 9, 2006 06:44 PM UTC

Thanks, It works now...


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