Type | Description | |||
Long | A long expression that specifies the number of events in the schedule. |
In order to enumerate the events we recommend using the for each statement, instead for i - 0 to Count - 1 as in the following samples.
The following VB sample shows how you can enumerate all events in the control:
Dim e As EXSCHEDULELibCtl.Event For Each e In Schedule1.Events Debug.Print "Event: " & e.Start & " to " & e.End Next
The following VB/NET sample shows how you can enumerate all events in the control:
For Each ev As exontrol.EXSCHEDULELib.Event In Exschedule1.Events Debug.Print("Event: " & ev.Start.ToString() & " " & ev.End.ToString()) Next
The following C# sample shows how you can enumerate all events in the control:
foreach (exontrol.EXSCHEDULELib.Event ev in exschedule1.Events) System.Diagnostics.Debug.Print("Event: " + ev.Start.ToString() + " " + ev.End.ToString());
The following VFP sample shows how you can enumerate all events in the control:
*** ActiveX Control Event *** LPARAMETERS operation * 1 ' exCalendarSelectionChange If Operation = 1 Then local d For Each d In thisform.Schedule1.Calendar.Selection WAIT WINDOW "Select: " + TTOC(d) ENDFOR EndIf
The following C++ sample shows how you can enumerate all events in the control:
IEnumVARIANTPtr spEnum = m_spSchedule->Events->_NewEnum; if ( spEnum != NULL ) { spEnum->Reset(); unsigned long n = 0; _variant_t vtElement; while( SUCCEEDED( spEnum->Next( 1, &vtElement, &n ) ) && ( n != 0 ) ) { EXSCHEDULELib::IEventPtr spEvent = V_DISPATCH( &vtElement ); if ( spEvent != NULL ) { CString sMessage; sMessage.Format(_T("Event: %f %f\r\n"), spEvent->Start, spEvent->End ); OutputDebugString( sMessage ); } } }
where m_spSchedule is of EXSCHEDULELib::ISchedulePtr type.