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