Codejock Forums Homepage
Forum Home Forum Home > Codejock Products > ActiveX COM > Calendar
  New Posts New Posts RSS Feed - Problem attaching calendar to datepicker
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

Problem attaching calendar to datepicker

 Post Reply Post Reply
Author
Message
glennj View Drop Down
Newbie
Newbie


Joined: 07 February 2006
Status: Offline
Points: 24
Post Options Post Options   Thanks (0) Thanks(0)   Quote glennj Quote  Post ReplyReply Direct Link To This Post Topic: Problem attaching calendar to datepicker
    Posted: 15 May 2006 at 12:36pm

I'm running vb.net application and have the calendar control and datepicker control on the same form.

I have added code in the form's load subroutine to attach the calendar to the date picker but it errors when it comes to running the program

Error is "Additional information: Specified cast is not valid.". It runs fine without the attachtocalendar command... I'm confused, can anyone help?

Code is

Private Sub frmDiary_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load

' Load diary entries

AxCalendarControl1.Options.EnableInPlaceEditEventSubject_ByM ouseClick = False

AxCalendarControl1.Options.EnableInPlaceEditEventSubject_Aft erEventResize = False

AxCalendarControl1.Options.EnableInPlaceEditEventSubject_ByF 2 = False

AxCalendarControl1.Options.EnableInPlaceEditEventSubject_ByT ab = False

AxCalendarControl1.Options.EnableInPlaceCreateEvent = False

AxCalendarControl1.Options.UseOutlookFontGlyphs = False

 

Dim NewEvent As CalendarEvent, Recurrence As CalendarRecurrencePattern

NewEvent = AxCalendarControl1.DataProvider.CreateEvent

NewEvent.Subject = "Valuation of 51 Adelphi Street, Campbell Park"

NewEvent.StartTime = #5/15/2006 3:00:00 PM#

NewEvent.EndTime = #5/15/2006 4:00:00 PM#

NewEvent.BusyStatus = CalendarEventBusyStatus.xtpCalendarBusyStatusBusy

NewEvent.Description = "Some nice notes here..."

NewEvent.Location = "Campbell Park"

NewEvent.Label = 1

AxCalendarControl1.DataProvider.AddEvent(NewEvent)

NewEvent = AxCalendarControl1.DataProvider.CreateEvent

NewEvent.Subject = "Valuation of The Old Gardens, Staverton"

NewEvent.StartTime = #5/16/2006 3:00:00 PM#

NewEvent.EndTime = #5/16/2006 4:00:00 PM#

NewEvent.BusyStatus = CalendarEventBusyStatus.xtpCalendarBusyStatusBusy

NewEvent.Description = "Some nice notes here..."

NewEvent.Location = "Campbell Park"

NewEvent.Label = 2

AxCalendarControl1.DataProvider.AddEvent(NewEvent)

NewEvent = AxCalendarControl1.DataProvider.CreateEvent

NewEvent.Subject = "Valuation of 31 Millfields, Writtle"

NewEvent.StartTime = #5/18/2006 3:00:00 PM#

NewEvent.EndTime = #5/18/2006 4:00:00 PM#

NewEvent.BusyStatus = CalendarEventBusyStatus.xtpCalendarBusyStatusBusy

NewEvent.Description = "Some nice notes here..."

NewEvent.Location = "Campbell Park"

NewEvent.Label = 3

AxCalendarControl1.DataProvider.AddEvent(NewEvent)

AxCalendarControl1.Populate()

AxCalendarControl1.DayView.ScrollToWorkDayBegin()

AxDatePicker1.AttachToCalendar(AxCalendarControl1)

End Sub

 

 

Back to Top
sserge View Drop Down
Moderator Group
Moderator Group


Joined: 01 December 2004
Status: Offline
Points: 1297
Post Options Post Options   Thanks (0) Thanks(0)   Quote sserge Quote  Post ReplyReply Direct Link To This Post Posted: 15 May 2006 at 5:33pm
Hi,

Note that AxOOO classes are VB.NET wrappers on top of OCX objects. So far, to fix up your code, just change the last line to the:

AxDatePicker1.AttachToCalendar(AxCalendarControl1.GetOcx())


--
WBR,
Serge
Back to Top
glennj View Drop Down
Newbie
Newbie


Joined: 07 February 2006
Status: Offline
Points: 24
Post Options Post Options   Thanks (0) Thanks(0)   Quote glennj Quote  Post ReplyReply Direct Link To This Post Posted: 16 May 2006 at 4:44am

Ah yes, that works perfect!

Thanks for your prompt help...

Back to Top
 Post Reply Post Reply
  Share Topic   

Forum Jump Forum Permissions View Drop Down

Forum Software by Web Wiz Forums® version 12.04
Copyright ©2001-2021 Web Wiz Ltd.

This page was generated in 0.173 seconds.