本例创建一个DateTimePicker控件,利用其ValueChanged事件,改变RickTextBox的值,程序运行界面如下。
程序代码如下。
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";
}
}
}

