Tamer_Ahmed
Centurion
hi in VB.net i can use ISNumeric to determine if it's numeric or not but in C# i can't use it can any body help
BOO!!!! Bad Vb'er Bad!!!Mister E said:Just reference Microsoft.VisualBasic and you can use the VB IsNumeric function in C#.
Tamer_Ahmed said:hi in VB.net i can use ISNumeric to determine if it's numeric or not but in C# i can't use it can any body help
Public Overloads Function IsNumeric(ByVal Value As Object) As Boolean
Dim RegEx As Regex
If Not Value Is Nothing Then
RegEx = New Regex("(\+|-)?[0-9][0-9]*(\.[0-9]*)?")
If RegEx.IsMatch(Value.ToString) AndAlso RegEx.Match(Value.ToString).Length = CType(Value, String).Length Then
Return True
Else
Return False
End If
Else
Return False
End If
End Function