Build an Array for MonthCalendar.BoldedDates

  • Thread starter Thread starter Bill Patten
  • Start date Start date
B

Bill Patten

oop's forgot the subject, sorry..

CF Group

I think I posted this on the wrong group (sqlServer.ce) so thought I'd try
here

After 6 hours of searching the web and trial and error I give up, even
though I can build an array of dates I can't figure out how to stuff it into
the monthcalander..

This works,
MonthCalendar1.BoldedDates = New System.DateTime() {New
System.DateTime(2006, 10, 18), New System.DateTime(2006, 10, 16)}

But I'd like to build the dates from a dataset that changes, not have to
hard code
some dates for effect.

This does not


dim dBold as datetime()
add some dates and try

MonthCalendar1.BoldedDates = dbold

Most of the samples I have found are either hard coded as above our use the
MonthCalendar.addBoldedDates that does not appear to be

included in Windows ce.5. Can someone share some code to build the array.

Thanks, Bill
 
I found a sample written in C#, and tried to convert it one line at a time
but still couldn't make it work. Then used
http://www.kamalpatel.net/ConvertCSharp2VB.aspx and converted it. Discovered
it add {} to the dim datetime line. Once I was aware of that the rest was
just normal debugging of code. Now can anyone tell me what the {} does and
how I should have known about it?

Thanks

If CalendarBindingSource.Count > 0 Then

Dim intcount As Integer

' The {} appears to add an extra element so used
CalendarBindingSource.Count.count - 1

Dim dbold() As DateTime = New DateTime(CalendarBindingSource.Count - 1)
{}

For intcount = 0 To CalendarBindingSource.Count - 1

currentRow = CalendarBindingSource.Current

Dim d As String = currentRow("startdate").ToString

dbold(intcount) = currentRow("startdate") '

CalendarBindingSource.MoveNext()

Next

MonthCalendar1.BoldedDates = (dbold)

End If
 
Back
Top