property Schedule.Selection as Variant
Returns or sets a safe array of selected events in the schedule panel.

TypeDescription
Variant A safe array of Event objects being or to be selected.
 The Selection property of control can be used to set or get the current selection (events) in the control's schedule panel. The Selection property of the Calendar object can be used to set or get the current selection (dates) in the control's calendar panel. The /NET and /WPF versions of the component provide the SelEvents function that retrieves a collection of Event objects, as List<Event>. The Selectable property of the Event indicates whether the event can be selected at runtime. The Selected property indicates whether the event is selected or unselected.

Once the user starts selecting a new event in the schedule panel, the control fires the LayoutStartChanging(exScheduleSelectionChange). Once a new event is selected, the LayoutEndChanging(exScheduleSelectionChange) event occurs. You can use the AllowSelectEvent property to change the key to allow the user select new events or you can prevent selecting any event using exDisallow value. 

The following sample shows how you can enumerate the selected events, once the LayoutEndChanging(exScheduleSelectionChange) event occurs.

VB

Private Sub Schedule1_LayoutEndChanging(ByVal Operation As EXSCHEDULELibCtl.LayoutChangingEnum)
    If Operation = exScheduleSelectionChange Then
        Dim d As Variant
        For Each d In Schedule1.Selection
            Debug.Print "Event: " & d.Start & " " & d.End
        Next
    End If
End Sub

VB/NET

Private Sub Exschedule1_LayoutEndChanging(ByVal sender As System.Object, ByVal Operation As exontrol.EXSCHEDULELib.LayoutChangingEnum) Handles Exschedule1.LayoutEndChanging
    If Operation = exontrol.EXSCHEDULELib.LayoutChangingEnum.exScheduleSelectionChange Then
        Dim evs As List(Of exontrol.EXSCHEDULELib.Event) = Exschedule1.SelEvents
        If Not evs Is Nothing Then
            For Each d As exontrol.EXSCHEDULELib.Event In evs
                Debug.Print("Event: " & d.Start & " " & d.End)
            Next
        End If
    End If
End Sub

C#

private void exschedule1_LayoutEndChanging(object sender, exontrol.EXSCHEDULELib.LayoutChangingEnum Operation)
{
    if ( Operation == exontrol.EXSCHEDULELib.LayoutChangingEnum.exScheduleSelectionChange  )
        {
            List<exontrol.EXSCHEDULELib.Event> evs = exschedule1.SelEvents;
            if ( evs != null )
                foreach (exontrol.EXSCHEDULELib.Event d in evs)
                    System.Diagnostics.Debug.Print("Event: " + d.Start.ToString() + " " + d.Start.ToString());
        }
}

VFP

*** ActiveX Control Event ***
LPARAMETERS operation
*	10 ' exScheduleSelectionChange
    If Operation = 10 Then
		local e as Object
		
		For Each e In thisform.schedule1.Selection 
			LOCAL ee as Object
			ee = thisform.Schedule1.Events(e)
			WAIT WINDOW TTOC(ee.Start) + " " + TTOC(ee.End)
		ENDFOR
    EndIf

C++

void CAddEventsDlg::LayoutEndChangingSchedule1(long Operation)
{
	if ( Operation == EXSCHEDULELib::exScheduleSelectionChange )
	{
		_variant_t evs = m_spSchedule->Selection;
		if ( V_VT( &evs ) == ( VT_ARRAY | VT_VARIANT ) )
		{
			BYTE* p = NULL;
			long nCount = 0;
			if ( SUCCEEDED( SafeArrayGetUBound( V_ARRAY( &evs ), 1, &nCount ) ) )
			{
				if ( SUCCEEDED( SafeArrayAccessData( V_ARRAY( &evs ), (LPVOID*)&p ) ) )
				{
					for ( long i = 0; i < nCount + 1; i++, p += sizeof(VARIANT) )
					{
						VARIANT* pValue = (VARIANT*)p;
						if ( V_VT( pValue ) == VT_DISPATCH )
						{
							EXSCHEDULELib::IEventPtr spEvent = V_DISPATCH( pValue );
							CString strMessage;
							strMessage.Format( _T("Event: %f %f\r\n"), spEvent->Start, spEvent->End );
							OutputDebugString( strMessage );
						}
					}
					SafeArrayUnaccessData( V_ARRAY( &evs ) );
				}
			}
		}
	}
}

where m_spSchedule is of EXSCHEDULELib::ISchedulePtr type.