Oulook 2003 crashes when opening a new dialog in property page (0/1)

S

Sander Kooij

Situation:
I am currently developing C# AddIn for Microsoft Outlook 2003.
One of the functions of the AddIn is to add a property page to the
Tools->Options page to configure some custom settings. On this
property page I have created 4 buttons that show, when pressed, a new
windows (standard form). When one of the buttons is pressed the
appropriate dialog is opened by using the ShowDialog() function, which
show a modal dialog.

Problem:
When one form window is opened and closed (by pressing one of the
buttons) everything is fine, but when a second window is opened and
closed, outlook crashes. I debugged my code to see if the problem
occurs in the second opened dialog. But this is not the case. Outlook
crashes after the dialog is closed and after the 'button event'
function which triggers the dialog to open is completed.
When the window is shown using the Show() function everything seems to
work fine. To be absolutely sure that is was not a bug in a different
section of my AddIn I created a new project and only added the
fundamental functions to reproduce the situation. Sadly the same
problem occurs.

Question:
After extensive research, I was unable to find a solution for this
problem. Has anybody seen or heard of this problem before, or knows a
solutions for this problem?

Thanks in advance

Gr.

- Sander Kooij


Code fragments for illustration:

Connect.cs
-----------------------------------------------------------------------

public void OnConnection(object application,
Extensibility.ext_ConnectMode connectMode, object addInInst, ref
System.Array custom)
{
// Application object is assigned o member variable
applicationObject =
(Microsoft.Office.Interop.Outlook.Application)application;
addInInstance = addInInst;
}


public void OnStartupComplete(ref System.Array custom)
{
// Rig-up new options event.
applicationObject.OptionsPagesAdd += new
ApplicationEvents_11_OptionsPagesAddEventHandler(applicationObject_OptionsPagesAdd);
}


private void applicationObject_OptionsPagesAdd(PropertyPages Pages)
{
// Add page to pages collection
Pages.Add(new TestPage(), "Untitled");
}


TestPage.cs
------------------------------------------------------------------------

private void button1_Click(object sender, System.EventArgs e)
{
// Create a new form
TestForm form = new TestForm();

// Show form
form.ShowDialog();
}
 

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