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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top