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.

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

Thread ID:

Created:

Updated:

Platform:

Replies:

43876 May 5,2006 04:04 PM May 9,2006 02:44 PM Windows Forms 4
loading
Tags: GridControl
Steve Killingsworthnolongercoding.NET
Asked On May 5, 2006 04:04 PM

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 07:55 PM

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 11:08 AM

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 05:37 PM

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 02:44 PM

Thanks, It works now...

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.

;