Com type object problems to get properties

153 Views Asked by At

I have the following code in VB.net :

 Dim objWorkspace As Object
 Dim nrobjects As Integer
 Dim dataretrieved As Integer

 objWorkspace = GetObject("", "Workspace.Application")
 objWorkspace.Documents.Open("d:\testimage.grf")

 nrobjects = objWorkspace.Parent.ActiveDocument.ActiveWindow.Application.ActiveDocument.Page.ContainedObjects.Count
 Dim info() As PropertyInfo   

 For Each Item In  objWorkspace.Parent.ActiveDocument.ActiveWindow.Application.ActiveDocument.Page.ContainedObjects
   testvar = Item
   info = testvar.GetType().GetProperties()
 Next

The little script is connected to a button on a form. When the button is pressed, a custom program is opened (Workspace) and a test image is loaded into it. This part works.

Then I try to get the number of objects on the loaded image. This also works, but when I try to get their properties, I get all the time nothing.

I tested in debug mode. When I try to access the in objWorkspace using the watch, I get the value "COM Type", and the content I can access only if I press the "Dynamic" field "Expanding will evaluate all members dynamically".

How can I access the fields dynamically within the code?

0

There are 0 best solutions below