If you have a COM object (i.e. you have a dll that contains COM components)
why not create an interop assembly.
Check the following out:
http://msdn.microsoft.com/library/de...priinterop.asp
HTH
Ollie Riches
"Robert Rotstein" <(E-Mail Removed)> wrote in message
news:lG_Xe.8427$T55.3556@trndny06...
> If I have accessed a COM object in this manner:
>
> Type MyType = Type.GetTypeFromProgID("someCOMobject");
> Object ThisObj = Activator.CreateInstance(MyType);
> object returnedItems = MyType.InvokeMember("someFunction",
> System.Reflection.BindingFlags.InvokeMethod, null, ThisObj, null);
>
> and I happen to know that returnedItems is a
> Microsoft.VisualBasic.Collection object, then what is the correct way to
> access the individual items in that collection? Doing
>
> foreach (object item in (Collection) returnedItems)
>
> causes an System.InvalidCastException exception.