使用DateTimePicker控件

本例创建一个DateTimePicker控件,利用其ValueChanged事件,改变RickTextBox的值,程序运行界面如下。

20120409091546 20120409091558

程序代码如下。

using System;
using System.Collections.Generic;
using System.Drawing;
using System.Windows.Forms;
namespace eg39_testApp
{
	public partial class MainForm : Form
	{
		public MainForm()
		{
			InitializeComponent();
		}
		
		void DateTimePicker1ValueChanged(object sender, EventArgs e)
		{
			richTextBox1.Text=dateTimePicker1.Value.Date.ToShortDateString()+"做的事情如下:\n";
			richTextBox1.Text+="------\n";
		}
	}
}
作者:codee
文章千古事,得失寸心知。


原文地址:https://www.cnblogs.com/bimgoo/p/2437290.html