本文介绍了从Datetimepicker中仅选择月份和年份的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述 如何从vb.net中的datetimepicker中仅选择月份和年份 推荐答案 dateTimePicker1.Format = DateTimePickerFormat.CustomdateTimePicker1.CustomFormat = "MMMM yyyy" 'or whatever you want 参考: http://msdn.microsoft.com/en-us/library/system.windows.forms.datetimepicker.format.aspx [ ^ ] Private Sub SalesDatePicker_ValueChanged(sender As Object, e As EventArgs) Handles SalesDatePicker.ValueChanged If SalesDatePicker.Value.Day <> 1 Then SalesDatePicker.Value = DateSerial(SalesDatePicker.Value.Year, SalesDatePicker.Value.Month, 1) End IfEnd Sub 这篇关于从Datetimepicker中仅选择月份和年份的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持! 09-16 09:53