Showing a form in an .Net Outlook Add-In


Craig Buchanan

I've created an Add-In for Outlook (2003) using VB.Net (VS 2005). I'm
having difficulty w/ getting either of the forms that I created to be

I've defined the forms as class-level variable in the Connect class. This
is the code that is executed in the method that handles the
(button is a CommandButtonBar) event:

form_Export = New Form_Export

What am I missing?


Craig Buchanan

Ken Slovak - [MVP - Outlook]

What exactly is happening? Is the form being started at all, does its
constructor get called? Is it a matter of the form not being on top or in
the front of the z-order? If it's a z-order issue have you tried setting the
form's .TopMost, TopLevel properties and/or the BringToFront() method?

Alan Moseley

Are you entirely sure that your add-in is loading? Has it been disabled
maybe. Have a look in Outlook, Help, About, Disabled Items.

Try putting a MsgBox in the Connect class to make sure that you are
connecting correctly.

Craig Buchanan

There was an exception in the form's constructor that being thrown but not
caught by Outlook, so the code hung. I've corrected the code and the form
works as expected.

Incidentally, is there a type of exception that I can be caught by Outlook?
Probably a COM-type exception, I'll wager.

Thanks for your time, Ken.

Craig Buchanan


There was an unhandled exception in the form's constructor that resulted in
the odd behavior.

Thanks for your reply.

Ken Slovak - [MVP - Outlook]

When you use a try...catch block in your managed code you'll be catching
both .NET errors as well as COM exceptions.

Depending on what your code is doing you might also cause unhandleable
exceptions that won't come to your error handling and in some cases might
only fire after your addin is disconnected or Outlook is closed. I've seen
that with some errors that were seen with WordMail where after exit you see
a kernel32 error.

Outlook itself isn't going to catch any errors for you, but it will fire
errors up through the CLR and those would be COM exceptions since Outlook is
unmanaged code.

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