469,282 Members | 1,666 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,282 developers. It's quick & easy.

DateTimePicker formatting

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

Nov 16 '05 #1
3 3481
Hi Sumit
Check out this sample extended DataTimePicker
http://www.thecodeproject.com/cs/mis...timepicker.asp

Mohamed M .Mahfouz
Developer Support Engineer
ITWorx on behalf of Microsoft EMEA GTSC

Nov 16 '05 #2
Sumit,

Is that not simpel using the dayofweek property of datetime and with the
datetime.adddays(the days to go)?

http://msdn.microsoft.com/library/de...classtopic.asp

http://msdn.microsoft.com/library/de...fweektopic.asp

Cor
Nov 16 '05 #3
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

"Cor Ligthert" <no************@planet.nl> wrote in message
news:e4**************@tk2msftngp13.phx.gbl...
Sumit,

Is that not simpel using the dayofweek property of datetime and with the
datetime.adddays(the days to go)?

http://msdn.microsoft.com/library/de...classtopic.asp

http://msdn.microsoft.com/library/de...fweektopic.asp

Cor



Nov 17 '05 #4

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

reply views Thread by Sumit | last post: by
4 posts views Thread by Jacek Jurkowski | last post: by
1 post views Thread by Aaron Smith | last post: by
7 posts views Thread by Clamara | last post: by
3 posts views Thread by Charlie | last post: by
3 posts views Thread by Simon Tamman | last post: by
5 posts views Thread by Terry | last post: by
4 posts views Thread by =?Utf-8?B?VGVycnk=?= | last post: by
reply views Thread by zhoujie | last post: by
reply views Thread by suresh191 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.