CodePanic! > C#.NET Tips > 今ここ
■DateTimePickerの使い方
DateTimePickerは日付入力を行う際に便利なコントロールです。
Formに貼り付けるだけですぐに使えます。
日時はDateTime型のValueプロパティーを設定・参照します。
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
namespace WindowsFormsApplication1
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void Form1_Load(object sender, EventArgs e)
{
// 年月日を設定
DateTime date = new DateTime(2008,7,31);
dateTimePicker1.Value = date;
}
}
}
Copyright © 2008.07 - shougo suzaki
|