Print Page | Close Window

Problem attaching calendar to datepicker

Printed From: Codejock Forums
Category: Codejock Products
Forum Name: Calendar
Forum Description: Topics Related to Codejock Calendar
URL: http://forum.codejock.com/forum_posts.asp?TID=4215
Printed Date: 22 November 2024 at 4:34am
Software Version: Web Wiz Forums 12.04 - http://www.webwizforums.com


Topic: Problem attaching calendar to datepicker
Posted By: glennj
Subject: Problem attaching calendar to datepicker
Date 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

 

 




Replies:
Posted By: sserge
Date 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


Posted By: glennj
Date Posted: 16 May 2006 at 4:44am

Ah yes, that works perfect!

Thanks for your prompt help...




Print Page | Close Window

Forum Software by Web Wiz Forums® version 12.04 - http://www.webwizforums.com
Copyright ©2001-2021 Web Wiz Ltd. - https://www.webwiz.net