Jeremieleroy Calendar View examples

Hi guys!

As title, I need some easy and clear examples on adding/editing events in this library…

I’ve checked the attached samples but I need a simple

Add event…statement…

thanxs!

Cirollo

the CalendarView Example has a Button “Add Event”

ok, and this is the code in the action event:

Dim D As new Date
D.Hour = 15
d.Minute = 0
d.Second = 0
Dim DD As new Date(D)
DD.Day = D.Day+1
DD.Minute = 1

//Set this to false so the event can’t be edited or dragged.
Dim Draggable As Boolean = True

Dim cEvent As New CalendarEvent(“Test”, D, DD)
cEvent.Editable = Draggable

CalendarView1.AddEvent(cEvent)

this is my code in my action event of the button (I’m using the calendar view on a web app)

Sub Action()
dim d as Date
d = new Date
d.Hour = 15
d.Minute = 0
d.Second = 0
dim evento as CalendarEvent
evento.StartDate=d
evento.EndDate=d
evento.Description=“test”
WebCalendarView1.AddEvent(evento)
WebCalendarView1.Redisplay
End Sub

but it doesn’t work! I get the NilObjectException

maybe…solved…

it wants

Dim cEvent As New CalendarEvent(“Test”, D, DD)

even if I prefer to setup the event like this…

dim evento as CalendarEvent
evento.StartDate=d
evento.EndDate=d
evento.Description=“test”

Hello Ciro,

CalendarEvent has two constructors

One with no parameters, to setup an Event like you are trying to:
http://www.jeremieleroy.com/wiki/index.php?title=CalendarEvent.Constructor

And the other constructor that expects at least a Title and StartDate.

The code you wrote should work but you need to add “new” to the class definition:

dim evento as new CalendarEvent evento.StartDate=d evento.EndDate=d evento.Description="test"

Hi Jrmie Leroy, thank you!

just another question, how can I catch the date selected in an event?

I need, after choosing a date, to assign it to a textfield, like a datepicker.

tried

msgbox(str(New Date(D)))

in the dateselected event of my webcalendarview1 but the msgbox never appears…

Hi,

I am not sure that str(New Date(D)) will work correctly.

You can use:

MsgBox d.sqlDate Msgbox d.longdate Msgbox d.shortdate

doesn’t work…

I have a calendar in a modal dialog…

The DateSelected event will only fire if the Calendarview is in DatePicker mode

me.ViewType = me.TypePicker

If you are displaying a full Calendar, you should use the NewEvent event, which has StartDate and EndDate parameters.

i wanto to select a date from the ViewType YEAR. how do i make this?
i make this–>If you are displaying a full Calendar, you should use the NewEvent event, which has StartDate and EndDate parameters… but with no results. sorry for my english

I am sorry CalendarView has no events declared for ViewType YEAR.
This will be changed in a near future.

Is it possible to disable the NewEvent event ? I don’t want to let some user to add events.
The EditEvent fires only after a NewEvent is fired.

Is it possible to change the range of day hours ? From 7.00 to 15.00 instead of 0.00 to 24.00.

Thank you.

Hello Marco,

For users who do not have the right to create events, set CreateWithDrag to False.
http://www.jeremieleroy.com/wiki/index.php?title=CalendarView.CreateWithDrag

Changing the range of day hours is a feature on the todo list.

Thank you