m7mdabuodeh m7mdabuodeh - 1 month ago 182
C# Question

C# DateTimePicker How to set MinValue from specific range to now?

How to set MinValue from specific range to now?

I have c# app that allows the user to insert some data to particular database and I want the user to choose and add date and time for some data from range of last month (last 30 days) to now.

I know how to set MaxValue to current time, but I don't know how to set the minimum value to last month!!

How to do that?

ajg ajg
Answer Source
dateTimePicker1.MinDate = DateTime.Now.AddDays(-30);