I need to have a pop-up dialog like the Color Dialog or Save Dialog but for choosing a date from a calendar. The DateTimePicker is what I need, but I don't know how to launch this like a pop-up dialog in C#.
You need to add a DateTimePicker to a form and show the form as a dialog:
var picker = new DateTimePicker();
Form f = new Form();
f.Controls.Add(picker);
var result = f.ShowDialog();
if(result == DialogResult.OK)
{
//get selected date
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With