Programming VB.Net

VB.Net: Outlook AddIn: Design mode or Runtime?

At the moment I write an AddIn for Microsoft Outlook 2007 in Visual Studio 2010, using .Net Framework 3.5. For this project I added some UserControl components which need to know if current state is design mode or runtime. Well, there is the possibilty to ask the component itself (via Me.DesignMode) but when you want to know that in general you can use this method if you want to know:

Dim IsDesignMode as Boolean = (Globals.ThisAddIn Is Nothing)
' Or
Dim IsRuntime as Boolean = (Globals.ThisAddIn IsNot Nothing)

Well, I have not found any documentation about when Globals.ThisAddIn is set and when not, but it makes sense that in design mode there is no AddIn instance. Let me kow if you think that this code does not the job it’s written for! Here it works ;)

Leave a Reply

Your email address will not be published. Required fields are marked *

Captcha * Time limit is exhausted. Please reload CAPTCHA.