<span style="font-size:14px;">vb.net中使用DateTimePicker控件,直接生成指定格式的日期内容,</span>
而且使用控件,还可以省去对其内容的日期check
但是,要设定该控件默认值为空,需要利用程序设定一下:
<span style="font-size:14px;">Public Class Form1 Private Sub <span style="color:#ff0000;">Form1_Load</span>(ByVal sender As System.Object,ByVal e As System.EventArgs) Handles MyBase.Load DateTimePicker1.Format = DateTimePickerFormat.Custom '注意:双引号之间有一个空格 DateTimePicker1.CustomFormat = </span><span style="font-size:14px;"><span style="color:#ff0000;">" " </span> End Sub Private Sub <span style="color:#ff0000;">DateTimePicker1_CloseUp</span>(ByVal sender As Object,ByVal e As System.EventArgs) Handles DateTimePicker1.CloseUp '指定Format"yyyy/MM/dd",可以避免软件运行系统不同,而显示不同的Format DateTimePicker1.Format = </span><span style="font-size:14px;"><span style="color:#ff0000;">"yyyy/MM/dd" </span> End Sub End Class </span>