torg Posted January 16, 2003 Posted January 16, 2003 I have ta textbox "txtInput " I would Like to hav an input mask alias "DD.MM.YYYY". How can I achieve this ? Quote
*Experts* Nerseus Posted January 16, 2003 *Experts* Posted January 16, 2003 It sounds like you may want the DateTimePicker control instead of a textbox. If you still want a MaskEdit, let us know. -nerseus Quote "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
torg Posted January 16, 2003 Author Posted January 16, 2003 I still want a MaskEdit :) I also want to be able to make an phonenumber input like this: "555-12345645". :) Quote
*Experts* Nerseus Posted January 16, 2003 *Experts* Posted January 16, 2003 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 Quote "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
torg Posted January 17, 2003 Author Posted January 17, 2003 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? :) Quote
*Gurus* divil Posted January 17, 2003 *Gurus* Posted January 17, 2003 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. Quote MVP, Visual Developer - .NET Now you see why evil will always triumph - because good is dumb. My free .NET Windows Forms Controls and Articles
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.