"Method not found" when using Visio.Shape.Picture property

B

B.Molsbeck

Hello,

I am developing an addin for Microsoft Visio 2003. One of the functions
of the addin shows a modal dialog with a picturebox. In that picturebox
I need to show a visual representation of a shape of the Visio
document.

I use the following code to retrieve and show the picture:

Dim theDocument As Microsoft.Office.Interop.Visio.Document =
Application.ActiveDocument
For Each thePage As Microsoft.Office.Interop.Visio.Page In
theDocument.Pages
For Each theShape As Microsoft.Office.Interop.Visio.Shape In
thePage.Shapes
Dim thePicture As stdole.IPictureDisp = theShape.Picture
Dim theShapeMetafile As System.Drawing.Imaging.Metafile = _
New System.Drawing.Imaging.Metafile(New IntPtr(thePicture.Handle),
False)
thePictureBox.Image = theShapeMetafile
....

But on the 4th line ("theShape.Picture") I receive the following error:
"Method not found: Microsoft.Office.Interop.Visio.Shape.get_Picture()"

What am I doing wrong? Does anybody know a different way to retrieve
the picture of a shape?

Thanks in advance for your help!

Greetings: Bastiaan Molsbeck ([email protected])
 
J

JuneTheSecond

Visio shape has Picture property but has not Get_Picture method.
You might check again your code.
 
B

B.Molsbeck

I am using the Picture property, but I think that the interop
internally uses the get_Picture() method, which causes the error.

Bastiaan.
 
J

JuneTheSecond

Now, I have the same error with you.
This is not the case in VBA.
I wonder something is missing, or bug in Visual Basic .Net.
 
B

B.Molsbeck

Is there a way to check for this error in code? Because when I use the
common Try...Catch construction, it does compile correctly. But when
the application runs, the JIT-Debugger is activated on that line of
code. I would like to prevent that to happen.

Bastiaan.
 
B

B.Molsbeck

I found the reason what caused the error:
Microsoft Visio was incorrect installed. When I removed it completely
from the system and reinstalled it with the default options, the code
works perfectly!

Bastiaan.
 
B

B.Molsbeck

Sorry, I do not know what was incorrect or missing with my Visio
installation.

As a last resort, I just removed and reinstalled Visio to verify that
my installation did not cause the problem. And what do you know: it
did!

Unfortunately, I cannot spend more time to investigate the corrupt
Visio installation. The important thing is that my problem is solved
and that it was not caused by my .NET code.

Bastiaan.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top