This project has moved and is read-only. For the latest updates, please go here.

Great control but not getting full use..

May 30, 2013 at 3:58 AM
Hi mate, great control so far.. But I am having some serious struggles loading the appointments from datatables etc. I've got it at the point where when resolving the appointments its not allowing them through for some reason.

Do you by any chance have a better Demo version than whats up on here? I have gone through it thoroughly. Any guidance would be appreciated, thanks
Jun 5, 2013 at 3:53 PM
Can you show some demo code that you use?
Jun 17, 2013 at 2:22 PM
Hi, apologies. I haven't worked on this for a while since I wasn't getting anywhere. I ended up working out the loading of appointments via a database. However, I am struggling to write an acceptable newevent function. I can achieve a sloppy version of a new event (with no column capture - so it doesnt refer to any staff)
With these 2 subs. I cannot work out a way to get the captured column. I have attempted to use the menu click event with NewAppointmentEventArgs and that doesnt work either. It throws an error message.

Have you worked out a working method for adding appointments? Because I see on your demo there is an option for 'New Appointment' but the menu item doesnt work. That made me quite curious... ;)
Public Sub dayView1_NewAppointment(ByVal m_appointment As Calendar.Appointment, args As Calendar.NewAppointmentEventArgs)
    ' Dim m_Appointment = New Calendar.Appointment()

    m_appointment.StartDate = args.StartDate
    m_appointment.EndDate = args.EndDate
    m_appointment.Title = args.Title
    m_appointment.Column = args.Column
    _appointments.Add(m_appointment)
End Sub

Private Sub ToolStripMenuItem1_Click(sender As Object, e As EventArgs) Handles ToolStripMenuItem1.Click


    '    '    Dim appointment As New Calendar.Appointment
    Dim m_Appointment = New Calendar.Appointment()

    m_Appointment.StartDate = DayView1.SelectionStart()
    m_Appointment.EndDate = DayView1.SelectionEnd
    m_Appointment.Title = MemberList_Diary.Tag.ToString
    '  m_Appointment.Column = e.Column
    _appointments.Add(m_Appointment)
End Sub
Jun 17, 2013 at 3:06 PM
I have just updated the demo with the following code:
        private void createAppointmentToolStripMenuItem_Click(object sender, EventArgs e)
        {
            Calendar.Appointment appt = new Calendar.Appointment();
            appt.ID = _appointments.Count;
            appt.Title = "New Appointment";

            DateTime date;
            int column;
            dayView1.GetColumnFromMousePosition(out column, out date);

            appt.StartDate = dayView1.SelectionStart;
            appt.EndDate = dayView1.SelectionEnd;
            appt.Object = lstPeople.CheckedItems[column];
            appt.Column = column;
            _appointments.Add(appt);
            dayView1.Invalidate();
        }
to get the column where the mouse is use the method:
GetColumnFromMousePosition
I also set the following property
RightMouseSelect = true;
Sorry not sure how it translates in VB

On another note there is a bug when you create an appointment by typing in dayview, I have added this to the issue tracker and it will be fixed for the next release

regards

Si