Peter,
In addition to the other comments.
Use the TypeOf operator to ensure that you have an object of the type you
are expecting...
Dim objAppointmentItem as AppointmentItem
Dim obj As Object = objItems.GetFirst()
If TypeOf obj Is AppointmentItem Then
objAppointmentItem = DirectCast(obj, AppointmentItem)
' do stuff with objAppointmentItem
End If
Hope this helps
Jay
"Peter van der Veen" <pvdveenRe_move_This @ no-spam-ming.vanbrug.nl> wrote
in message news:tu********************************@4ax.com...
Hi
In my VB.net application i got on different times (and not allways) an
System.InvalidCastException.
The line of code is:
objAppointmentItem = objItems.GetFirst
Does anyone know what to do???
Peter