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.

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

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.

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
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.