Results 1 to 4 of 4

Thread: [RESOLVED] Editing 3rd party calendar control

Threaded View

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    May 2008
    Location
    Bunker Hill, WV
    Posts
    154

    Resolved [RESOLVED] Editing 3rd party calendar control

    I know I'm probably breaking protocol by asking this question here, but I'm not sure who else can help me.

    I'm trying to use a 3rd party calendar control found at http://www.codeproject.com/KB/select...hCalendar.aspx. The control is great and significzantly expands on the MS MonthCalendar control. However, I'm using VB not C# so I'm having trouble manipulating the properties of the control.

    Specifically, I'm at a loss for how to add new dates into the "Dates" property array. I currently have been pulling dates from a database using the following code:

    Code:
            Using DateItem As New Pabo.Calendar.DateItem            
    
                Try
    
                    Dim EffectiveDates As New List(Of Pabo.Calendar.DateItem)
                    Dim AppointmentDates As New DataTable
                    AppointmentDates = Me.TblGroupScheduleTableAdapter1.GetDataByDateFilter()
    
                    For Each r As DataRow In AppointmentDates.Rows
                        'My problem is here: How can I convert the existing Date format to
                        'the new DateItem format in this add statement?
                        EffectiveDates.Add(CDate(r("AppointmentDate")))
                    Next
    
                    EffectiveDates.Sort()
                    Dim MyDateArray As Pabo.Calendar.DateItem() = EffectiveDates.ToArray
    
                    Me.clndrAppointments.AddDateInfo(MyDateArray)
    
                Catch ex As Exception
                    MsgBox(ex.Message)
                    Exit Sub
    
                End Try
    
            End Using
    Here's the author's example:

    Code:
    private void FormatDates()
    {
        DateItem[] d = new DateItem[5]; 
        d.Initialize(); 
        for (int i = 0;i<5;i++)
            d[i] = new DateItem();
    
        d[0].Date = new DateTime(2005,6,3);
        d[0].BackColor1 = Color.Red;
        d[0].ImageListIndex = 3;
        d[0].Text = "Help";
        d[1].Date = new DateTime(2005,6,12);
        d[1].ImageListIndex = 2;
        d[2].Date = new DateTime(2005,6,16);
        d[2].BackColor1 = Color.LightBlue;
        d[2].ImageListIndex = 8;
        d[3].Date = new DateTime(2005,6,18);
        d[3].BackColor1 = Color.GreenYellow;
        d[3].ImageListIndex = 1;
        d[3].Text = "NorDev";
        d[4].Date = new DateTime(2005,6,22);
        d[4].ImageListIndex = 1;
        d[4].Text = "Cebit";
    
        monthCalendar1.AddDateInfo(d);
    }
    I guess I have one other concern, also. Because I'm using a "Using" block (which I've never done before) will I lose these dates from the array once the block ends and the programs discards the new data type?

    I know this should be posted on the author's site, and I've done that, but no one seems to be monitoring it anymore. I just need a nudge in the right direction here.

    Thanks from anyone who can help.
    Last edited by ssmith147; May 27th, 2008 at 09:43 AM.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width