Strange Behaviour of Visio 2007 Drawing Control

A

Asif

Hi all,

I did make a sample project by simply adding Visio 2007 drawing control
on form and one button to assign control source property to file name
using VB.NET.

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button1.Click
If Me.OpenFileDialog1.ShowDialog() = DialogResult.OK Then
Try
AxDrawingControl1.Src = Me.OpenFileDialog1.FileName
Catch ex As Exception
MessageBox.Show(ex.Message)
End Try
End If
End Sub

The drawing control is opening selected file but once I am going to add
new page through Insert Page context menu (right clicking on page name
to open menu) it is giving me the following error

An unhandled exception of type 'System.NullReferenceException' occurred
in system.windows.forms.dll

Additional information: Object reference not set to an instance of an
object.

Can any one tell me whets I am doing wrong?

Thanks

Asif
 
A

Asif

Sorry, I did forget to mention that error is occurred once I click
Insert Page Dialog Ok button.

Asif
 
A

Al Edlund

works fine on my system. I'd start by checking the project setup for the
necessary library references there.
al
 
A

Asif

Hi Edlund,

I did check the library references and they are aready added under
References section

AxInterop.Microsoft.Office.Interop.VisOcx
Microsoft.Office.Interop.Visio
Microsoft.Office.Interop.VisOcx

Can you / anyone help me to find whats wrong with my code.

Asif
 
A

Al Edlund

and where is the typelib and what versions are installed/called? I found
myself forgetting to update the correct versions in sub-projects and getting
conflicts when I started to migrate my stuff..
al
 
A

Asif

I did not transfer the existing application. I did just make a new
sample application by dropping Visio 2007 drawing control (version
12.0) on form with only one button. On button click, following code is
executed

If Me.OpenFileDialog1.ShowDialog() = DialogResult.OK Then
AxDrawingControl1.Src = Me.OpenFileDialog1.FileName
End If

The file is opening normally but once to Insert new page exception is
thrown.

An unhandled exception of type 'System.NullReferenceException' occurred

in system.windows.forms.dll

One more important point is that if I click on Continue (Arrow) button
of Visual Studio another exception is thrown:

An unhandled exception of type
'System.Runtime.InteropServices.SEHException' occurred in
system.windows.forms.dll

Additional information: External component has thrown an exception

I think control reference is either dispose or there is some other way
to handle open file in Visio 2007.

I can even provide the sample application which is tested on system
running Visio 2007 and .NET Framework 1.1.
 

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