If you''ve set a cell type to double, it seems a user can still enter alpha characters. When you tab out of that field, Syncfusion throws up a message box.
I simply want it to ignore alpha characters, either on tab out (by reverting to the previous value) or even just ignoring them when they''re typed.
How can I achieve this?
ADAdministrator Syncfusion Team July 1, 2004 09:37 AM
If you want to ignore them as they are typed, try handling CurrentCellValidateString, and cancel things if the e.Text is not valid. Here is code that checks for numbers in column 1.
Private Sub grid_CurrentCellValidateString(ByVal sender As Object, ByVal e As GridCurrentCellValidateStringEventArgs) Handles grid.CurrentCellValidateString
Dim d As Double
Dim cc As GridCurrentCell = Me.grid.CurrentCell
If cc.ColIndex = 1 AndAlso e.Text.Length > 0 _
AndAlso Not Double.TryParse(e.Text, Globalization.NumberStyles.Any, Nothing, d) Then
e.Cancel = True