How to: Add Windows Forms to Outlook Solutions
This example adds a Windows Form to a Microsoft Office Outlook project and displays the form to the user.
Applies to: The information in this topic applies to application-level projects for Outlook 2007 and Outlook 2010. For more information, see Features Available by Office Application and Project Type.
To add a Windows Form to an Outlook add-in solution
On the Project menu, click Add Windows Form.
In the Add New Item dialog, select Windows Form. Name the form MainForm and click Add.
Add a button to the form.
Double-click the button to add a Click event handler to the code and open the code view.
Add the following code to the Click event handler of the button.
Me.Close()
this.Close();
In Solution Explorer, double-click ThisAddIn.vb (in Visual Basic) or ThisAddIn.cs (in C#) to open the code file. Add the following code to the ThisApplication_StartUp event handler.
Dim mainForm As New MainForm() mainForm.ShowDialog()
MainForm formMain = new MainForm(); formMain.ShowDialog();
Press F5 to build and run the solution.
See Also
Concepts
Getting Started Programming Application-Level Add-Ins