Search code examples
c#winformsdatepicker

How can I set a DateTimePicker control to a specific date?


How can I set a DateTimePicker control to a specific date (yesterday's date) in C# .NET 2.0?


Solution

  • Just need to set the value property in a convenient place (such as InitializeComponent()):

        dateTimePicker1.Value = DateTime.Today.AddDays(-1);