textbox text

  • 15 years ago


    I have a question about textbox input mask and displaying dates in textbox.

    1. input mask - is there a way I can make input mask for textbox (ex. DD.MM.YYYY) so user when he is tiping doesn't have to input comma?

    2. how can I display in textbox only date without time? My textbox is bind to database (field is date type). value witch is displayed is date + time.


  • 15 years ago

    For your second query use this:


    TextBox1.Text = DateTimeVariable.ToShortDateString()


    "I would love to change the world, but they won't give me the source code."

  • 15 years ago

    I suggest you use a DateTimePicker instead of a TextBox.  That's what they're for.  If your column doesn't allow null values then the standard DTP will do the job fine.  If you do want to allow null values, there is a library of free components available at the link below that includes a nullable DTP.  Rest assured that the library is free.  I've checked with the author and received e-mail confirmation.


  • 15 years ago

    thanx guys,

    jmcilhinney, that is nice component, thanx

    any sugestion for input mask?

  • 15 years ago

    If you're determined to use a TextBox then you'll need to either create your own masked TextBox or use an existing third party control.  .NET 2.0 includes a managed MaskedTextBox but in .NET 1.1 you would have to use the MS ActiveX MaskedEditControl, which you can add to the Toolbox from the Com Components tab.  The alternative would be to download one, and there are plenty around.  There's at least avaialble from www.codeproject.com I think, although I can't claim to have used any of them.

  • 15 years ago

    one I have found on codeproject doesn't work's as I want, it has few bugs.

    yes, I use .NET 1.1

    i'll see about MaskedEditControl...

Post a reply

Enter your message below

Sign in or Join us (it's free).


Why not write for us? Or you could submit an event or a user group in your area. Alternatively just tell us what you think!

Our tools

We've got automatic conversion tools to convert C# to VB.NET, VB.NET to C#. Also you can compress javascript and compress css and generate sql connection strings.

“Measuring programming progress by lines of code is like measuring aircraft building progress by weight.” - Bill Gates