如何清除数据绑定日期时间选择器?
How to clear a data bound date time picker?
我在 windows 表单上将日期绑定到日期时间选择器控件。
dtpDOB.Value = Convert.ToDateTime(reader[4]);
当我想清除它时,我在按钮单击事件下使用了这段代码。
我就是这样做的。
dtpDOB.Format = DateTimePickerFormat.Custom;
dtpDOB.CustomFormat = "";
dtpDOB.Checked = false;
但是不行。
如何解决?
这应该对您有所帮助 example1 在选择器字段中显示空白
还有这个Example2
我在 windows 表单上将日期绑定到日期时间选择器控件。
dtpDOB.Value = Convert.ToDateTime(reader[4]);
当我想清除它时,我在按钮单击事件下使用了这段代码。 我就是这样做的。
dtpDOB.Format = DateTimePickerFormat.Custom;
dtpDOB.CustomFormat = "";
dtpDOB.Checked = false;
但是不行。 如何解决?
这应该对您有所帮助 example1 在选择器字段中显示空白
还有这个Example2