In the form, i have a datetimepicker tool, and 2 button. So, my question is, which code can i shut down the pc, and how can i read the selected time from the datetimepicker ( which is set to time ( h/m ) ) ?
namespace WindowsFormsApplication1
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void Form1_Load(object sender, EventArgs e)
{
}
private void dateTimePicker1_ValueChanged(object sender, EventArgs e)
{
dateTimePicker1.Format = DateTimePickerFormat.Short;
dateTimePicker1.Value = DateTime.Today;
}
private void button1_Click(object sender, EventArgs e)
{
DateTime iDate;
iDate = dateTimePicker1.Value;
MessageBox.Show("A kiválasztott dátum: " + iDate);
}
private void button2_Click(object sender, EventArgs e)
{
DateTime iDate;
iDate = dateTimePicker1.Value;
MessageBox.Show("A kiválasztott dátum: " + iDate);
}
}
}