Solved

MonthCalendar selection and bolding

Posted on 2009-04-08
6
392 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
  • 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
3 Use Cases for Connected Systems

Our Dev teams are like yours. They’re continually cranking out code for new features/bugs fixes, testing, deploying, testing some more, responding to production monitoring events and more. It’s complex. So, we thought you’d like to see what’s working for us.

 
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

3 Use Cases for Connected Systems

Our Dev teams are like yours. They’re continually cranking out code for new features/bugs fixes, testing, deploying, testing some more, responding to production monitoring events and more. It’s complex. So, we thought you’d like to see what’s working for us.

Question has a verified solution.

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

Summary Displaying images in RichTextBox is a common requirement with limited solutions available. Pasting through clipboard or embedding into RTF content only support static images.  This article describes how to insert Windows control objects int…
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…
In this video I am going to show you how to back up and restore Office 365 mailboxes using CodeTwo Backup for Office 365. Learn more about the tool used in this video here: http://www.codetwo.com/backup-for-office-365/ (http://www.codetwo.com/ba…
Sending a Secure fax is easy with eFax Corporate (http://www.enterprise.efax.com). First, just open a new email message. In the To field, type your recipient's fax number @efaxsend.com. You can even send a secure international fax — just include t…

863 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

20 Experts available now in Live!

Get 1:1 Help Now