Category Archives: WinForms

A form of writing applications that involves designing each application UI through the Visual Studio Form Designer.

HOW TO: Write Your First Outlook 2010 Addin

Writing an Outlook 2010 Addin is a very easy task given the tools that Microsoft provides.  While it does require some knowledge about what you are doing and where you are going, overall the Outlook 2010 addin functionality is a robust system that gives you the flexibility you need to get the information required.

I am a big supporter of Outlook as an email client as well as a scheduling tool.  A huge advantage that Microsoft Office has over most of the competition is the ability to easily write addins and communicate with all other tools that are Office related.  An Outlook 2010 addin is no exception to this and it provides a great way to embed ideas and activities into your own interface without much work.  Developing an Outlook 2010 addin has been designed to be so easy that you can start right away simply by installing Visual Studio 2010 and Office 2010.

Creating an Outlook 2010 Addin

To get started an Outlook 2010 addin, Open up the New Solution window and navigate to the Office -> 2010 Section of your preferred language.

outlook 2010 addin - new  solution window

As a test, let’s create a custom tab in our Outlook and use it to pop a Hello World window.  To do this, open the Add New Item window and navigate to Office -> Ribbon (Visual Designer)

outlook 2010 addin - new  item window

How to implement an Outlook 2010 Addin that shows a new ribbon

To choose which Ribbon you are modifying, select the Ribbon Type on the right hand side.  For this example I chose the Explorer Ribbon so it shows up directly on the Office 2010 main ribbon.

On the left side of the Ribbon Designer you will get some nice pre-built Microsoft Office controls to use, simply drag a button onto the Ribbon.

outlook 2010 addin - new  ribbon button

At this point simply double click your button to bring up an event and type in the Message Box command to print Hello World.  If your Outlook is running you will need to close it to deploy.  Once closed, run your add-in through debug mode and it will pop up Outlook with your added loaded into it.

outlook 2010 addin - hello world

Writing an Outlook 2010 addin can be very simple or very complex based on what you want to do with it.  Just like with any coding you should start easy and have fun to start.  If you are interested in more information about writing an Outlook 2010 addin check out this MSDN article for more detail.

Dot Net Framework in Windows 8?

Recently more and more people have been asking me about whether or not WinForms will be in Windows 8.  A more serious question has also been whether or not the Dot Net Framework will be in Windows 8, which would be a huge drawback if it were not.  The framework is far from over, as it is a foundation to how most developers write code for the Windows platform.  Whether or not you know you are using .NET albeit in WPF or through WinForms you are using DotNet.

That being said, Microsoft will likely not cancel their support for their own framework in the new operating system, but expand upon it to provide more useful functionality to developers.  Officially, Microsoft stopped supporting WinForms in Visual Studio 2005 and has not touched it since.  There have been random hot fixes but no new major development and more important no developer support.  Whether or not developers will be forced to move to WPF instead of WinForms to take advantage of the new functionality of Windows 8 is yet to been, but the dying support levels for WinForms should be reason enough to move.

As for any language barriers, just like with any coding language at some point it will die out and you will have to learn something new.  My advice to any developer or user of the Windows platform who is afraid of learning something new is to give up the fear.  We will all move forward and keep our jobs, and eventually be better for it because that is what we do as a society.  Happy coding!

HOW TO: Make a MDI child window start up in center of parent window

When creating a new instance of a MDI child form, the form will load in cascading order in relation to the open forms by default. Most of the time this is acceptable, but if you run into a situation where you want to load it in the center of the parent you may run into a bit of trouble.The default property for showing a form in the center of a parent looks like this:

C#

MdiChildUI form = new MdiChildUI();
form.MdiParent = this;
form.StartPosition = FormStartPosition.CenterParent;
form.Show();

VB.NET

Dim form As New MdiChildUI
form.MdiParent = Me
form.StartPosition = FormStartPosition.CenterParent
form.Show()

To make the window show by default in the center of a MDI parent, you must set the StartPosition to be CenterScreen as opposed to CenterParent. In a MDI environment, child forms consider the parent MDI window to be their screen.

C#

form.StartPosition = FormStartPosition.CenterScreen;

VB.NET

form.StartPosition = FormStartPosition.CenterScreen