c# 从零到精通 form界面 时间DateTimePicker控件、获取DateTimePicker控件的内容

c# 从零到精通 form界面 时间DateTimePicker控件、获取DateTimePicker控件的内容
using System;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
namespace Test14
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void Form1_Load(object sender, EventArgs e)
{
dateTimePicker1.Format = DateTimePickerFormat.Custom;
dateTimePicker1.CustomFormat = “MMMM dd, yyyy - dddd”;
label1.Text = dateTimePicker1.Text;
}
}
}
using System;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
namespace Test15
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void Form1_Load(object sender, EventArgs e)
{
textBox1.Text = dateTimePicker1.Text;
textBox2.Text = dateTimePicker1.Value.Year.ToString();
textBox3.Text = dateTimePicker1.Value.Month.ToString();
textBox4.Text = dateTimePicker1.Value.Day.ToString();
}
}
}

你可能感兴趣的:(c#,开发语言)