Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim Dis As System.Windows.Forms.DateTimePicker = New System.Windows.Forms.DateTimePicker()
' Set the MinDate and MaxDate.
Dis.MinDate = New DateTime(1985, 6, 20)
Dis.MaxDate = DateTime.Today
' Set the CustomFormat string.
Dis.CustomFormat = "MMMM dd, yyyy - dddd"
Dis.Format = Windows.Forms.DateTimePickerFormat.Custom
' Show the CheckBox and display the control as an up-down control.
Dis.ShowCheckBox = True
Dis.ShowUpDown = True
Dis.Show()
End Sub
但是当我按下按钮并运行代码时,什么都不会显示。我认为应该有一种方法可以简单地以编程方式显示此对话框。谁能帮我吗? :-)
仅供参考,如果有帮助,我正在VB 2010中对此进行编码? :-\
我试图做到这一点,因此当用户按下按钮时,将显示DateTimePicker对话框,我什至希望获得他们选择的结果日期。这是我到目前为止的内容:Private Sub ...
DateTimePicker
不同于OpenFileDialog, SaveFileDialog, PrintDialog
或其他类似对话框。DateTimePicker
。这是我能弄清楚该怎么做的最佳解决方法。