Click here to Skip to main content
15,893,401 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
hi friends
plz tell me to adding callender in our window based project which we pick date as like from 11\11\11 to 12\12\12...
Thanks...
From-Niraj New Delhi[INDIA]
Posted
Comments
Karthik Harve 7-Dec-11 4:45am    
do you mean the calender must show dates between 11/11/11 to 12/12/12..??

explain...!!!!!!!!
niraj kumar 2012 7-Dec-11 4:56am    
plz tell me code how to add calender which i pick the starting date to ending date and calender not sho only show calender icon after text box exampe i know about the management system project which find out the record between giving date...
thanks...

1 solution

If you add a DateTimePicker to your application, you can set the MinDate and MaxDate properties to the limits you require. The user will not be able to select a date outside that range.


"i wants to textbox1->pick date like as 7\12\11
textbox2->pick date 1\4\12 after then we get record any emp between these days...
thanks.."



Don't use text boxes - use two DateTimePickers instead - that way the user gets to enter the date in his preferred format without any work from you (so if he is American his date will be set to MM/dd/yyyy and if he is European his date will be dd/MM/yyyy).
To retrieve records from a database just use the values:
C#
SqlCommand cmd = new SqlCommand("SELECT * FROM myTable WHERE myDate BETWEEN @START AND @END", con);
cmd.Parameters.AddWithValue("@START", dtpStartDate.Value);
cmd.Parameters.AddWithValue("@END", dtpEndDate.Value);
...
 
Share this answer
 
v2
Comments
niraj kumar 2012 7-Dec-11 4:56am    
plz tell me code how to add calender which i pick the starting date to ending date and calender not sho only show calender icon after text box exampe i know about the management system project which find out the record between giving date...
thanks...
OriginalGriff 7-Dec-11 5:07am    
Sorry? That doesn't make a lot of sense...Please try to explain in more, shorter words. I realize this is probably a language problem, but if I don't understand your question, I can't help!
niraj kumar 2012 7-Dec-11 5:30am    
i wants to textbox1->pick date like as 7\12\11
textbox2->pick date 1\4\12 after then we get record any emp between these days...
thanks..
OriginalGriff 7-Dec-11 6:43am    
Answer updated

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