We are setting up a Calendar control to give our users the option of using the control to change the times for a specific event by dragging an event, or by using the mouse to drag the start or end times of an event. The code we've been trying is shown below.
Two problems. When our form opens up, the calendar control is frequently not visible. When I click on the area where the calendar control should be, it shows up, but not until then. ???
Second problem. We set up the event to be edited by the user in code (see below). This event could be at the beginning of a day or at the end, so we want the control to scroll forward to make sure the event is visible to the user. What we're doing is not working...any ideas why not?
ConnectionString = "Provider=XML;Data Source=" & App.Path & "\Events.xml" With CalendarControl1 .SetDataProvider ConnectionString If Not .DataProvider.Open Then .DataProvider.Create End If .DataProvider.RemoveAllEvents 'We don't want previously saved events .DataProvider.Save .Options.FirstDayOfTheWeek = g_lFirstDayOfWeek .DayView.TimeScale = g_lTimeScale .Options.WorkDayStartTime = TimeValue(g_sStartTime) .Options.WorkDayEndTime = TimeValue(g_sEndTime) End With DatePicker1.MaxSelectionCount = 1 DatePicker1.AttachToCalendar CalendarControl1
CalendarControl1.ActiveView.ShowDay CDate(cbpStartDate.Text), True Set m_oEvent = CalendarControl1.DataProvider.CreateEvent m_oEvent.StartTime = cbpStartDate.Text & " " & cbpTimes(0).Text m_oEvent.EndTime = cbpStartDate.Text & " " & cbpTimes(1).Text
CalendarControl1.DataProvider.AddEvent m_oEvent
CalendarControl1.Populate 'CalendarControl1.DayView.ScrollToWo rkDayBegin 'We CAN get this line to work 'We CAN'T get the following to work ' Dim lCellNo As Long '' lCellNo = CalendarControl1.DayView.GetCellNumber(CDate("10/9/2005 1:00:00 PM")) '' CalendarControl1.ActiveView.EnableVScroll True '' CalendarControl1.DayView.ScrollV lCellNo
|