Search code examples
c#outlook-addintabindex

Button TabIndex on imported Outlook form regions in Visual Studio?


I have OL&VS 2010. If I design a form region directly in VS, then the FormRegion.Designer.cs file will contain definitions like:

this.SomeButton = new System.Windows.Forms.Button();

but if designed in OL and imported, the definitions are:

this.SomeButton = (Microsoft.Office.Interop.Outlook.OlkCommandButton)GetFormRegionControl("SomeButton");

My problem is that a System.Windows.Forms.Button has a TabIndex property that I can programmatically set, but a Microsoft.Office.Interop.Outlook.OlkCommandButton does not.

How can I change an OlkCommandButton's TabIndex?


Solution

  • I was able to cast a Microsoft.Office.Interop.Outlook.OlkCommandButton to a Microsoft.Vbe.Interop.Forms.Control and access the element's TabIndex that way.

    Edit - Confirmed: http://blogs.msdn.com/b/rgregg/archive/2007/10/01/common-properties-on-outlook-controls.aspx