CodeItBetter Programming Another VB Programming Blog

How to Check whether the given string has only numbers

Posted on January 5, 2009
1
2
3
4
5
6
7
8
9
10
11
12
13
'String Manipulation - How to Check whether the given string has only numbers
Public Function isTypeNumberWithChar(ByVal strTestString As String) As Boolean
    Dim intCount As Integer
    isTypeNumberWithChar = True
    For intCount = 1 To Len(strTestString)
        If Not IsNumeric(Mid$(strTestString, intCount, 1)) Then Exit Function
    Next intCount
    isTypeNumberWithChar = False
End Function
 
'How can I call this function:
'Debug.Print isTypeNumberWithChar("06040031")
'Debug.Print isTypeNumberWithChar("0604d0031")
Comments (0) Trackbacks (0)

No comments yet.


Leave a comment


 

No trackbacks yet.