Custom Formating a DateTimePicker using CultureInfo

倖福魔咒の 提交于 2020-01-05 06:45:12

问题


I am using the DateTimePicker control in a Vb.Net Windows project.

I would like the date to reflect the Regional Settings on the user's computer, but also to show the month name, rather than the month number.

For example, if my computer is set to English(US), I would like to see Nov 26 2009, and if my computer is set to English (NZ), I would like to see 26 Nov 2009

Is this possible?

I know that I can set the CustomFormat property to say "dd MMM yyyy", but then that always shows 26 Nov 2009, even with the regional setting of English(US).

Is there someway I can use the CultureInfo.CurrentCulture to set the date for all cultures? (i.e. not just a select case statement that sets the CustomFormat based on the CurrentCulture).

Thanks.


回答1:


Saw this new article on CodeProject that may help:

Culture Aware Month Calendar and Datepicker

Note that control is in C#, but of course you can use the DLL in your VB project.

It looks like what you need though I haven't tried it.



来源:https://stackoverflow.com/questions/1836354/custom-formating-a-datetimepicker-using-cultureinfo

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!