Field formatting Dateedit devExpress Windows Forms

Asked

Viewed 188 times

0

I have a date formatting problem with the date component dateEdit of devExpress. I need the field date formatted as follows: 01/01/2016. And when typing the values, go to the next character without having to type the "/" to pass to the other field (month/year). Another constraint is that this field must accept empty or null value.

For when clearing the date field it puts an initial date that is 01/01/0001, but should stick with __/ __/____.

  • What you’ve already done?

  • I have tried several ways: -Nulltext = "MM/dd/yyyy" Editformat = Editformat.Custom Editformatstring = "MMMM dd, yyyy" -Editformat = Editformat.Simple Editformatstring = "99/99/9999" I have tried several switches. And none of them satisfied what I needed.

  • Have you opened a call in Devexpress? If you have a valid license they answer in less than 1 day. But I will try to answer the question..

1 answer

0

You need to modify the editing mask:

dateEdit1.Properties.Mask.Culture = new System.Globalization.CultureInfo("pt-BR");
dateEdit1.Properties.Mask.EditMask = "dd/MM/yyyy";
// como você usou 01/01/2016 não dá pra saber se é d/m ou m/d, mude para:
//dateEdit1.Properties.Mask.Culture = new System.Globalization.CultureInfo("en-US");
//dateEdit1.Properties.Mask.EditMask = "MM/dd/yyyy";         
dateEdit1.Properties.Mask.UseMaskAsDisplayFormat = true;
dateEdit1.Properties.CharacterCasing = CharacterCasing.Upper;

As for the null value, I cannot reproduce this problem here on my machine. Maybe you have modified the NullDate, or has changed the AllowNullInput

Browser other questions tagged

You are not signed in. Login or sign up in order to post.