当用户按下按钮时(无需向窗体添加控件),如何显示DateTimePicker对话框
我试图做到这一点,以便当用户按下按钮时,显示DateTimePicker对话框,我什至希望获得他们选择的结果日期。这是我到目前为止的内容:
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中对此进行编码? :-\\
没有找到相关结果
已邀请:
2 个回复
诫商
缔恃钨