0

I have just made a small application in VB6 and would like to implement data validation for a few fields. Like the user can only enter a number in the Telephone number field.

How can this be implemented ?

Thanks.

3
Contributors
3
Replies
4
Views
8 Years
Discussion Span
Last Post by rm_daniweb
0

In VB press CTRL+T or right click on the toolbox and select components. A dialog will come up. Scroll down to the Microsoft Masked Edit Control. Selrct it and click OK. Place it on your form, select it, and press F1 to read all about it.

Good Luck

0

In VB press CTRL+T or right click on the toolbox and select components. A dialog will come up. Scroll down to the Microsoft Masked Edit Control. Selrct it and click OK. Place it on your form, select it, and press F1 to read all about it.

Good Luck

Thanks !!

That was really helpful.

______________

Solved.

0
Function FormatPhoneNumber(Text As String) As String
    Dim tmp As String
    If Text <> "" Then
        ' First get rid of all embedded dashes, if any.
        tmp = FilterString(Text, "0123456789")
        ' Then reinsert them in the correct position.
        If Len(tmp) <= 7 Then
            FormatPhoneNumber = Format$(tmp, "!@@@-@@@@")
        Else
            FormatPhoneNumber = Format$(tmp, "!@@@-@@@-@@@@")
        End If
    End If
End Function
This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.