locked
Textbox Data Validation RRS feed

  • Question

  • Dear Team,

    I want to validate entered data in a textbox like if first two digits of typed value are not 92 than on lost focus it should give error like "Kindly enter phone number in corrrect format"

    Kindly suggest the VB code for this?

    Friday, January 13, 2012 5:43 PM

Answers

  • Dear Team,

    I want to validate entered data in a textbox like if first two digits of typed value are not 92 than on lost focus it should give error like "Kindly enter phone number in corrrect format"
    Kindly suggest the VB code for this?


    Double click the "LostFocus" and let's say——

    Private Sub TextBox1_LostFocus(ByVal sender As Object, _
        ByVal e As System.EventArgs) Handles TextBox1.LostFocus
        If(TextBox.Text.StartWith("92")=False) Then
               MsgBox("Kindly enter phone number in corrrect format!")
        End If
    End Sub


       QQ我:讨论(Talk)
    下载MSDN桌面工具(Vista,Win7)
    我的博客园
    慈善点击,点击此处
    • Proposed as answer by Bob Wu-MT Monday, January 16, 2012 5:20 AM
    • Marked as answer by anwar.mustafa Monday, January 16, 2012 1:39 PM
    Monday, January 16, 2012 5:14 AM