Version

Locate an Activity

Sometimes you need to get a hold of an Activity object contained in the Activities collection of the WebScheduleInfo™. You can loop over the contents in this collection to check properties on the Activity (or any objects extending the Activity base class, such as Appointment ) to find the needed Activity.

The following code finds the first Activity with an Importance property value of Low, so that your application can take some action on it.

In Visual Basic:

Imports Infragistics.WebUI.Shared
Imports Infragistics.WebUI.WebSchedule
...
Private Function FindAppointment() As Appointment
	' Loop over the Activities, returning the first one
	' that has an Importance of Low.
	Dim index As Integer
	For index = 0 To Me.WebScheduleInfo1.Activities.Count
		Dim current As Activity = Me.WebScheduleInfo1.Activities(index)
		If ( current.Importance = Importance.Low ) Then
			Return CType(current, Appointment)
		End If
	Next index
	' Return Nothing if no matching Activity was found.
	Return Nothing
End Function

In C#:

using Infragistics.WebUI.Shared;
using Infragistics.WebUI.WebSchedule;
...
private Appointment FindAppointment()
{
	// Loop over the Activities, returning the first one.
	// that has an Importance of Low.
	int index;
	for( index = 0; index < this.WebScheduleInfo1.Activities.Count; ++index)
	{
		Activity current = this.WebScheduleInfo1.Activities[index];
		if ( current.Importance == Importance.Low )
			return current as Appointment;
	}
	// Return null if no matching Activity was found.
	return null;
}