Click here to Skip to main content
15,880,651 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
Hi ,i am going to develop an windows application in which i want an following thing
datetimepicker in which when i select the month then it will show the number of days in that selected month into a text box
Eg.
If i select Nov-2011 in datetimepicker then in the textbo it will hows the number of days in nov-2011 i.e 30

If i select Dec-2011 then it will show 31 in textbox
i want this code in c#.net which method should i used & how please help me with an example.



Thanx.
Posted

1 solution

You only have to check the datetimepicker's value: Does the returned month have 31 (Jan, Mar, May, Jul, Aug, Oct, Dec) or 30 (Apr, Jun, Sep, Nov) days or in case it's February, check whether the year is a leap year or not. Then insert this number in your textbox.

But I see, you say "i want this code in c#.net". Just try it yourself, you might like the warm feeling of having accomplished this (relatively simple) task yourself. :-)
 
Share this answer
 
Comments
Sergey Alexandrovich Kryukov 19-Nov-11 16:34pm    
Agree, a 5. Also, OP should understand: there is no just "Windows application". It could be WPF, Forms or even something else.
--SA
Smithers-Jones 19-Nov-11 17:08pm    
Thanks a lot.
thatraja 20-Nov-11 0:29am    
My 5! too. Still we are getting this kind of old questions :sigh:
Smithers-Jones 21-Nov-11 6:08am    
Thanks. :)

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900