Posted By

mecha on 10/22/10


Tagged


Versions (?)

Validate Integer Extension Method


 / Published in: VB.NET
 

  1. ''' <summary>
  2. ''' Validate integer.
  3. ''' </summary>
  4. ''' <param name="value">The value.</param>
  5. ''' <returns>
  6. ''' <c>true</c> if the specified value is integer; otherwise, <c>false</c>.
  7. ''' </returns>
  8. <System.Runtime.CompilerServices.Extension()> _
  9. Public Function IsInteger(ByVal value As String) As Boolean
  10. If String.IsNullOrEmpty(value) Then
  11. Return False
  12. End If
  13. Dim tempNo As Integer
  14. Return Integer.TryParse(value, tempNo)
  15. End Function

Report this snippet  

You need to login to post a comment.