WinForms Dialog DateTimePicker?

I need to have a popup dialog such as the Color dialog box or the Save dialog box, but to select a date from the calendar. DateTimePicker is what I need, but I donโ€™t know how to start it as a popup dialog in C #.

+4
source share
2 answers

You need to add a DateTimePicker to the 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 } 
+7
source

DateTimePicker is a Control , not a Form . You will need to create your own Form and add a control to it; There is no standard dialog for selecting dates.

+1
source

Source: https://habr.com/ru/post/1304186/


All Articles