Solved

How do you check if a maskedtextbox control is empty ?

Posted on 2006-11-23
8
1,048 Views
Last Modified: 2008-02-01

I have a mask of : 00/00/0000 90:00

But need to check if its empty, the .text property returns "__/__/____ __:__"

So I can't check to see if the text = the original mask.

I'm close to pulling my hair, and I don't have allot left ... help !

There must be some logic I'm missing ...
0
Comment
Question by:Kinger247
8 Comments
 
LVL 34

Expert Comment

by:Sancler
Comment Utility
This is working for me

    Private Sub mtb_TextChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles mtb.TextChanged
        If mtb.Text = "  /  /       :" Then
            Debug.WriteLine("Empty")
        Else
            Debug.WriteLine("Not empty")
        End If
    End Sub

Roger
0
 
LVL 13

Accepted Solution

by:
newyuppie earned 500 total points
Comment Utility
if you use something like this:

If String.IsNullOrEmpty(MaskedTextBox1.Text) Then
   MessageBox.Show("Im Empty")
End If

does that work?
NY
0
 
LVL 5

Expert Comment

by:DEEPESH
Comment Utility
USe MaskedTextBox1.TextMaskFormat property
hope it works for u
0
 
LVL 62

Expert Comment

by:Fernando Soto
Comment Utility
Hi Kinger247;

        If MaskedTextBox1.Text = "__/__/____ __:__" Then
            Console.WriteLine("Masked Text Box Is Empty")
        Else
            Console.WriteLine(Masked Text Box Is NOT Empty)
        End If

Fernando
0
Top 6 Sources for Identifying Threat Actor TTPs

Understanding your enemy is essential. These six sources will help you identify the most popular threat actor tactics, techniques, and procedures (TTPs).

 
LVL 10

Author Comment

by:Kinger247
Comment Utility
Would you believe I closed the wrong question .... I'll reopen...

newyuppie, you got some free points !
But alas, your code didn't work.
0
 
LVL 10

Author Comment

by:Kinger247
Comment Utility
0
 
LVL 13

Expert Comment

by:newyuppie
Comment Utility
oops, sorry about that. you can ask for refund no?
0
 
LVL 10

Author Comment

by:Kinger247
Comment Utility
no, its ok, ... my fault.. I've just reposted.
0

Featured Post

Why You Should Analyze Threat Actor TTPs

After years of analyzing threat actor behavior, it’s become clear that at any given time there are specific tactics, techniques, and procedures (TTPs) that are particularly prevalent. By analyzing and understanding these TTPs, you can dramatically enhance your security program.

Join & Write a Comment

I think the Typed DataTable and Typed DataSet are very good options when working with data, but I don't like auto-generated code. First, I create an Abstract Class for my DataTables Common Code.  This class Inherits from DataTable. Also, it can …
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…
This tutorial demonstrates a quick way of adding group price to multiple Magento products.

743 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

18 Experts available now in Live!

Get 1:1 Help Now