Solved

MonthCalendar selection and bolding

Posted on 2009-04-08
6
386 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
6 Surprising Benefits of Threat Intelligence

All sorts of threat intelligence is available on the web. Intelligence you can learn from, and use to anticipate and prepare for future attacks.

 
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

What Should I Do With This Threat Intelligence?

Are you wondering if you actually need threat intelligence? The answer is yes. We explain the basics for creating useful threat intelligence.

Join & Write a Comment

Flash (http://en.wikipedia.org/wiki/Adobe_Flash) has evolved over the years to where it has become a masterful tool for displaying content screen.  It has excellent layout placement, UI precision as well as rendering capabilities. This, along with t…
A basic question.. “What is the Garbage Collector?” The usual answer given back: “Garbage collector is a background thread run by the CLR for freeing up the memory space used by the objects which are no longer used by the program.” I wondered …
This demo shows you how to set up the containerized NetScaler CPX with NetScaler Management and Analytics System in a non-routable Mesos/Marathon environment for use with Micro-Services applications.
You have products, that come in variants and want to set different prices for them? Watch this micro tutorial that describes how to configure prices for Magento super attributes. Assigning simple products to configurable: We assigned simple products…

746 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

12 Experts available now in Live!

Get 1:1 Help Now