Jump to content
Xtreme .Net Talk

Recommended Posts

  • *Experts*
Posted

It sounds like you may want the DateTimePicker control instead of a textbox.

 

If you still want a MaskEdit, let us know.

 

-nerseus

"I want to stand as close to the edge as I can without going over. Out on the edge you see all the kinds of things you can't see from the center." - Kurt Vonnegut
  • *Experts*
Posted

By DD-MM-YYYY are you assuming numbers for each place? A mask like ##-##-####...? You can't really mask the date values specifically (to limit MM to 01-12 but not 13 for instance).

 

I don't have a lot of experience with MaskEdit but I think you can set the mask to ##-##-####.

 

Come to think of it, is this a .NET control? Do they still have a MaskEdit control? Or are you saying you want to limit a textbox to the DD-MM-YYYY format programmatically?

 

If you want your own custom format, you can put something in the Validating event. Check the Text property against your "mask" (or use a DateTime variable to see if it's a valid, recognized format). If it fails, set the event args Cancel to true and do whatever else you want (change the BackColor, etc.).

 

-Ner

"I want to stand as close to the edge as I can without going over. Out on the edge you see all the kinds of things you can't see from the center." - Kurt Vonnegut
Posted

Yes, I want A mask like ##-##-####..

Wether MaskedEdit is a .NET control or Not, is a question I haven`t been able to answer my self.

In the last section of your anser, you say something about custom format. , validating and text property. Could you give me a closer description of your suggestion ? Maybe with a code example? :)

  • *Gurus*
Posted

There is no Masked Edit control in .NET. You shouldn't use the COM one either.

 

I suggest you validate data using a normal textbox instead. I wrote this tutorial on doing custom validation, and it could be expanded easily using regular expressions.

MVP, Visual Developer - .NET

 

Now you see why evil will always triumph - because good is dumb.

 

My free .NET Windows Forms Controls and Articles

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...