开发者

C# locale-aware MaskedTextBox mask for DateTime values

C# locale-aware MaskedTextBox mask for DateTime values

I'm working through FXCop/Code Analysis's Globalization warnings and would like to know the proper, locale-aware way to set and get DateTime values through a MaskedTextBox.

My fo开发者_开发问答rm has a MaskedTextBox element with its Culture property set to "en-US", and its Mask property set to "00/00/0000" (the predefined Short date format). maskedTextBox.Text = now.ToString() displays without leading-zeros as "42/42/010_", yet I would like it to be represented as "04/24/2010".


For a user's aspect, no matter how good your MaskedTextBox supports my culture, it is far more difficult to use compared to a DateTimePicker,

http://msdn.microsoft.com/en-us/library/system.windows.forms.datetimepicker.aspx

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜