Solved

MonthCalendar selection and bolding

Posted on 2009-04-08
6
399 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
Webinar: Aligning, Automating, Winning

Join Dan Russo, Senior Manager of Operations Intelligence, for an in-depth discussion on how Dealertrack, leading provider of integrated digital solutions for the automotive industry, transformed their DevOps processes to increase collaboration and move with greater velocity.

 
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

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

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

In my previous article (http://www.experts-exchange.com/Programming/Languages/.NET/.NET_Framework_3.x/A_4362-Serialization-in-NET-1.html) we saw the basics of serialization and how types/objects can be serialized to Binary format. In this blog we wi…
Today I had a very interesting conundrum that had to get solved quickly. Needless to say, it wasn't resolved quickly because when we needed it we were very rushed, but as soon as the conference call was over and I took a step back I saw the correct …
Attackers love to prey on accounts that have privileges. Reducing privileged accounts and protecting privileged accounts therefore is paramount. Users, groups, and service accounts need to be protected to help protect the entire Active Directory …
Are you ready to implement Active Directory best practices without reading 300+ pages? You're in luck. In this webinar hosted by Skyport Systems, you gain insight into Microsoft's latest comprehensive guide, with tips on the best and easiest way…

710 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