Sub btnSave_Click
Dim chkDay As Int
DateTime.DateFormat = "dd/MM/yyyy"
DateTime.TimeFormat = "HH:mm"
Dim ChkDate As String = DateTime.Date(Main.DateRet)
If chkAllDay.Checked = True Then
Dim tfrom As Long = Main.DateRet
Dim tTo As Long = Main.DateRet
chkDay=1
Else
If btnTimeFrom.xLBL.Text = "" Then 'needs better error checking
Msgbox("No time entered or All day not checked", "Time(s) or All day required")
Return
End If
Dim tfrom As Long = DateTime.datetimeParse(ChkDate,btnTimeFrom.xLBL.Text)
Dim tTo As Long = DateTime.datetimeParse(ChkDate,btnTimeTo.xLBL.Text)
chkDay=0
End If
Log("chkDate " & ChkDate & " tTo " & tTo & " tfrom " & tfrom)
Dim econValues As List
econValues.Initialize
econValues.Add(Main.wmCalendar1.econ.ALL_DAY)
econValues.Add(Main.wmCalendar1.econ.DESCRIPTION)
econValues.Add(Main.wmCalendar1.econ.DTEND)
econValues.Add(Main.wmCalendar1.econ.DTSTART)
econValues.Add(Main.wmCalendar1.econ.TITLE)
econValues.Add(Main.wmCalendar1.econ.ORGANIZER)
econValues.Add(Main.wmCalendar1.econ.LOCATION)
econValues.Add(Main.wmCalendar1.econ.EVENT_END_TIMEZONE)
econValues.Add(Main.wmCalendar1.econ.EVENT_TIMEZONE)
Dim theEvent As EventInfo
theEvent.Initialize
theEvent.allDay = chkDay
theEvent.description = txtDescription.Text
theEvent.visible = 1
theEvent.dateTimeEnd = tTo
theEvent.dateTimeStart = tfrom
theEvent.title = txtTitle.Text
theEvent.organizer = txtOrganiser.Text
theEvent.location = txtLocation.Text
theEvent.timeZone = "UTC"
theEvent.endTimeZone = "UTC"
Log("the event " & theEvent)
Dim newEventID As Int = Main.wmCalendar1.AddEvent(Main.ScalendarID, theEvent, econValues)
If newEventID < 0 Then
Msgbox("The Entry could not be added", "DITL Calendar")
Else
Msgbox("The Entry has been added", "DITL Calendar")
End If
StartActivity(Main)
End Sub