VBcoders Guest



Don't have an account yet? Register
 


Forgot Password?



validating a fax number

by prabhakar (1 Submission)
Category: Miscellaneous
Compatability: VB 6.0
Difficulty: Unknown Difficulty
Originally Published: Thu 18th October 2001
Date Added: Mon 8th February 2021
Rating: (1 Votes)

validating a fax number

API Declarations


Dim j As String


Rate validating a fax number



Dim j As String
Public Function valid(s As String)

        i = 1
        While (i <= Len(s))
        j = Mid(s, i, 1)
        'MsgBox Asc(j) & " " & j
        
        If (Asc(j) >= 40 And Asc(j) < 59 Or Asc(j) = 32) Then
         If (i + 1 <= Len(s)) Then
                
            If ((Asc(j) = 45) And Asc(Mid(s, i + 1, 1)) = 45 Or ((Asc(j) = 45) And i = 1)) Then
                con = 1
                GoTo la
            End If
         End If
         
            If (Asc(j) = 43) And i > 1 Then
                con = 1
                GoTo la
            End If
            
            con = 0
        Else
            con = 1
            GoTo la:
        End If
        
        i = i + 1
        Wend
la:
test (con)
End Function
Public Function test(c As Integer)
    If c = 1 Then
        MsgBox "Error"
    Else
        MsgBox "Continue"
    End If
    
End Function



Private Sub Command1_Click()
    Module1.valid (Text1.Text)
End Sub



Download this snippet    Add to My Saved Code

validating a fax number Comments

No comments have been posted about validating a fax number. Why not be the first to post a comment about validating a fax number.

Post your comment

Subject:
Message:
0/1000 characters