When I try to perform a search on my function based on a phone number with eg. 4444444444, this exception comes to me. How can I fix it?
This is my code:
If IsNumeric(Trim(tbNumSearch.Text)) Then
SearchByNumber(Val(tbNumSearch.Text)) 'this is where I get the error
End If
Sub SearchByNumber(ByVal telNumber As Integer)
End Sub
But when I search with eg. 4444, I don't get this error.
I suppose I'm making a mistake in the conversion. Maybe this is a 64 bit number. Anyway, I can't find a solution. Please help.
I'm guessing SearchByNumber()
expects an Integer
. Signed Integer
values only go up to about 2 billion, and can't express anything higher. In other words, it's not large enough to handle US phone numbers, which could get close to 10 billion, or 20 billion with the long-distance prefix.
You could fix this by changing to a Long
, or by using Strings
.
Collected from the Internet
Please contact [email protected] to delete if infringement.
Comments