Results 1 to 5 of 5

Thread: Problem in Maskedtextbox

  1. #1

    Thread Starter
    Fanatic Member
    Join Date
    Nov 2010
    Posts
    965

    Problem in Maskedtextbox

    on the lost focus event of maskedtextbox i made a code that

    if maskedtextbox1.text = "" then
    msgbox("enter your number")

    BUT as focus losts so it does not give message, because masked textbox is not empty because when we give mask so it uses " - " in it. so please assist me in this that what code i write to solve this problem.?

    mask is 00000-0000000-0

  2. #2
    I'm about to be a PowerPoster! Hack's Avatar
    Join Date
    Aug 2001
    Location
    Searching for mendhak
    Posts
    58,333

    Re: Problem in Maskedtextbox

    How about
    vb.net Code:
    1. If MaskedTextBox1.Text = "00000-0000000-0" Then

  3. #3

    Thread Starter
    Fanatic Member
    Join Date
    Nov 2010
    Posts
    965

    Re: Problem in Maskedtextbox

    Quote Originally Posted by Hack View Post
    How about
    vb.net Code:
    1. If MaskedTextBox1.Text = "00000-0000000-0" Then
    HI Hack, this code is not working, it still doesn't give the message.

  4. #4
    Addicted Member vb_ftw's Avatar
    Join Date
    Dec 2010
    Posts
    139

    Re: Problem in Maskedtextbox

    hello abid,

    this should work...it checks the entire mask for completeness...

    vb Code:
    1. If Not MaskedTextBox1.MaskCompleted Then
    2.             msgbox("enter your number")
    3.         End If

  5. #5

    Thread Starter
    Fanatic Member
    Join Date
    Nov 2010
    Posts
    965

    Re: Problem in Maskedtextbox

    Thank You very much sir. its working, but would you please tell me the purpose of this code? i mean you have written that it checks the entire mask for completeness, so what does it means please explain.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width