DateTimePicker formatting

  • Thread starter Thread starter Sumit
  • Start date Start date
S

Sumit

Hi All

I am using DateTimePicker Control in my application.
On form Load i want to set the value in the DateTimePicker to nearest
coming Sunday.

Can anyone suggest me how to do it ????

Warm Regards
Sumit
 
Agreed. It's crude, but this should work.

DateTime dt = DateTime.Today;
while (dt.DayOfWeek != DayOfWeek.Sunday){
dt.AddDays(1);
}
dtp.Value = dt;

Hope this helps,

Dan Cox
 
Back
Top