所选的日期时间选择器值应仅是月份和年份 [英] Date time picker value selected should be only month and year

查看:83
本文介绍了所选的日期时间选择器值应仅是月份和年份的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



我的表单上有一个Datetime选择器,我希望在加载表单时,日历中不应仅显示月份和年份,而用户应该只能选择月份和年份,而不能选择单个日期.

谢谢,
Tushar.

Hi,

I have a Datetime picker on my form and i want that when the form is loaded the calendar should not be shown only the months and years should be shown on the picker and the user should be able to only select month and year not the individual dates.

Thanks,
Tushar.

推荐答案

private void test_Load(object sender, EventArgs e)
        {
            dateTimePicker1.Format = DateTimePickerFormat.Custom;
            dateTimePicker1.CustomFormat = "MMMM ,yyyy";
        }


这篇关于所选的日期时间选择器值应仅是月份和年份的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆