本文主要介绍了C#中将dateTimePicker初始值设置php为空,具体如下:
/www.devze.com/窗体初始化事件 private void Form1_Load(object sender, EventArgs e) { this.dateTimePicker1.Format = DateTimePickerFormat.Custom; thiandroids.dateTimePicker1.CustomFormat = " "; //" "引号中间必须有空格 //this.dateTimePicker1.Checked = false; } private void dateTimePicker1_ValueChanged(object sender, EventArgs e) { this.dateTimePicker1.Format = DateTimePickerFormat.Long; this.dateTimePicker1.CustomFormat = null; } //清空按钮事件 private void button1_Click(object sender, EventArgs e) { php this.dateTimePicker1.Format = DateTimePickerFormat.Custom; this.dateTimePicker1.CustomFormat = " "; this.dateTimePicker1.Checked = false; } //读取按钮事件 private void button2_Click(object sender, EventArgs e) { if(dateTimePicker1.Text==" ") { 开发者_开发培训 this.textBox1.Text = "日期为空!"; } else { this.textBox1.Text = this.dateTimePicker1.Text; INuoBP } }
到此这篇关于C#中将dateTimePicker初始值设置为空的文章就介绍到这了,更多相关C# dateTimePicker初始值为空内容请搜索我们以前的文章或继续浏览下面的相关文章希望大家以后多多支持我们!
精彩评论