Validate Integer Extension Method


/ Published in: VB.NET
Save to your folder(s)



Copy this code and paste it in your HTML
  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


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.