Solved

MonthCalendar selection and bolding

Posted on 2009-04-08
6
400 Views
Last Modified: 2013-11-26
I have a MonthCalendar control that I want to display multiple selected date ranges.

I have got dates bolding at the moment, but I need them to be selected.
Dim dgvRow As DataGridViewRow = Me.dgvLeave.Rows(e.RowIndex)
  
        calHolidayCalendar.RemoveAllBoldedDates()
        Dim startDate As DateTime = dgvRow.Cells(1).Value
        Dim endDate As DateTime = dgvRow.Cells(2).Value
 
        Dim timeSpan As TimeSpan = endDate.Subtract(startDate)
        Dim selectedDates As DateTime() = New DateTime(timeSpan.Days) {}
 
        For index As Integer = 0 To selectedDates.Length - 1
            calHolidayCalendar.AddBoldedDate(startDate.AddDays(Convert.ToDouble(index)))
 
        Next
 
        calHolidayCalendar.UpdateBoldedDates()

Open in new window

0
Comment
Question by:mgordon-spi
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 2
6 Comments
 
LVL 48

Expert Comment

by:jpaulino
ID: 24104829
Hi,
You can use SelectionRange to define your selection. Something like:
 

        Dim rg As New SelectionRange
        rg.Start = startDate
        rg.End = endDate
 
        Me.calHolidayCalendar.SelectionRange = rg

Open in new window

0
 
LVL 83

Expert Comment

by:CodeCruiser
ID: 24105768
0
 

Author Comment

by:mgordon-spi
ID: 24121374
Hi All,

Thanks for the responses. I am aware of the SelectionRange  - however I need to be able to have multiple ranges selected at once.

The only way I have ben able to do that is by setting the dates Bold.
0
Online Training Solution

Drastically shorten your training time with WalkMe's advanced online training solution that Guides your trainees to action. Forget about retraining and skyrocket knowledge retention rates.

 
LVL 48

Expert Comment

by:jpaulino
ID: 24122292
I don't think you can do that. You can only have one selection range active.
Bold dates seems to be the solution on use any other custom control
0
 

Author Comment

by:mgordon-spi
ID: 24127152
In that case, is it possible to overload the calendar control and change the bold style? I know its possible with the WEB Calendar control, but cant seem to find a way to do this with the winforms control. If we could at least change the forcolor of any dates that are set to bold then this wold be an adequate solution.
0
 
LVL 48

Accepted Solution

by:
jpaulino earned 500 total points
ID: 24127179
MonthCalendar as allot limitations and you cannot work as you want with him. Why don't you use another custom and free control like this one:
 Another Month Calendar
http://www.codeproject.com/KB/selection/MonthCalendar.aspx
 You can also find some more in here:
http://www.codeproject.com/KB/selection/
 
0

Featured Post

More Than Just A Video Library

Train for your certification. Learn the latest DevOps tools. Grow your skillset to do better work.

At Linux Academy, we release new training modules every week so you'll always be up to date on the latest tech.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In my previous two articles we discussed Binary Serialization (http://www.experts-exchange.com/A_4362.html) and XML Serialization (http://www.experts-exchange.com/A_4425.html). In this article we will try to know more about SOAP (Simple Object Acces…
A long time ago (May 2011), I have written an article showing you how to create a DLL using Visual Studio 2005 to be hosted in SQL Server 2005. That was valid at that time and it is still valid if you are still using these versions. You can still re…
Monitoring a network: why having a policy is the best policy? Michael Kulchisky, MCSE, MCSA, MCP, VTSP, VSP, CCSP outlines the enormous benefits of having a policy-based approach when monitoring medium and large networks. Software utilized in this v…
If you’ve ever visited a web page and noticed a cool font that you really liked the look of, but couldn’t figure out which font it was so that you could use it for your own work, then this video is for you! In this Micro Tutorial, you'll learn yo…

636 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