[已解决]在C#中将日期时间纠察控件设置为仅选择月份和年份 [英] [Solved] Set Date time picket control in C# to select only month and year
问题描述
请让我知道如何在C#中设置日期时间控件以仅选择月份和年份.
我确实尝试将格式设置为自定义格式,并将自定义格式设置为"MM yyyy".但是当它运行时,它仍然在日期选择器控件中显示日期Panal.
我不想向用户显示日期选择面板,因为它没有用.
请以这种方式帮助我.
Hi ,
Please let me know how to set up date time control in C# to select only month and year.
I did tried to set format as custom format and set custom format as "MM yyyy". but when it run it still shows date panal in date picker control.
I don''t want to display the date selection panal to my user since it is of no use.
Please help me in this way.
推荐答案
设置
dateTimePicker1.ShowUpDown = true;
怎么样?
这显示了一个旋转按钮控件(上-下控件),而不是一个下拉日历?
是否已将DateTimePicker.Format设置为Custom?
This show a spin button control (up-down control), rather than a drop-down calendar ?
Have you set DateTimePicker.Format to Custom ?
timePicker.Format=DateTimePickerFormat.Custom
这篇关于[已解决]在C#中将日期时间纠察控件设置为仅选择月份和年份的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!