Solved

Date range selection using MonthCalendar control in vb.net 2005

Posted on 2007-12-06
5
1,861 Views
Last Modified: 2013-11-26
I am using the MonthCalendar control on a form trying to allow a user to select either 1 day or a range of days up to 1 week (7 days).  I know how to allow this selection and I believe I can handle it fine, but I cannot figure out how to get the control to display the highlighted range.  

For instance, if I allow a 'MaxSelectionCount=7' and then run the app, the control loads and I try to select a range by dragging from monday to friday.  In doing this, half of Monday is highlighted and half of Friday is Highlighted, but everything in between is a white block.  I have not been able to figure out how to make that whole range highlighted as if I just selected one day.

I assume I should be clicking and dragging to select my range...?

I have seen this posted on other forums, but haven't seen a solution yet and didn't see one when I searched here.

Thanks for the help,

rgn
0
Comment
Question by:rgn2121
  • 3
  • 2
5 Comments
 
LVL 47

Accepted Solution

by:
Wayne Taylor (webtubbs) earned 125 total points
ID: 20433842
Hi rgn2121,

That is how the selecting of multiple dates works. You'll notice the start and end dates are not just half shaded, but also at the top and bottom, which look a bit like brackets. AFAIK, there is no way to avoid this behavior.

Wayne
0
 
LVL 12

Author Comment

by:rgn2121
ID: 20435014
Okay, I can't believe I would have to live with that if used, but I guess I will.

Like my info shows, I am not an expert in .net or VB, but when the control is click for dat selection, I assume it is invalidated every time the user highlights another day.  Can this intercepted along with the Paint event so that it could be highlighted correctly?  If that is possible, I am still not sure since there doesn't seem to be a property for the highlighting of the days...

thoughts?
0
 
LVL 47

Expert Comment

by:Wayne Taylor (webtubbs)
ID: 20435745
I suggest staying with the current behavior. Selecting multiple days with a MonthCalendar does not actually select multiple days, but a start and end date.
0
 
LVL 12

Author Comment

by:rgn2121
ID: 20441160
Okay...last question.  What should I use for a range selection?  The one with the drop down?
0
 
LVL 47

Expert Comment

by:Wayne Taylor (webtubbs)
ID: 20444968
The one with the dropdown (DateTimePicker) is used for selecting single dates. To select a range of dates, use the MonthCalendar.
0

Featured Post

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

Welcome my friends to the second instalment and follow-up to our Minify and Concatenate Your Scripts and Stylesheets (http://www.experts-exchange.com/Programming/Languages/.NET/ASP.NET/A_4334-Minify-and-Concatenate-Your-Scripts-and-Stylesheets.html)…
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…
This video gives you a great overview about bandwidth monitoring with SNMP and WMI with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're looking for how to monitor bandwidth using netflow or packet s…

760 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

22 Experts available now in Live!

Get 1:1 Help Now