View Single Post
  #6  
Old May 12th 09, 07:06 PM posted to microsoft.public.outlook.program_addins
Ken Slovak - [MVP - Outlook]
external usenet poster
 
Posts: 5,848
Default Multiple Toolbars being added/Multiple Buttons being added to

For optional missing values use System.Reflection.Missing.Value instead of
using Nothing. I usually define a class or global _missing variable object
for that.

In general, unless you are using a built-in control it's usually better to
not specify the ID argument and to supply the missing value for that also.
So I'd code that as:

button_1 = CType(newToolBar.Controls.Add(1, _missing, _missing, _missing,
True),
Office.CommandBarButton)

Also, when you set the other properties of any button you create make sure
to always use a unique Tag property. That prevents the button Click() event
from firing as many times as you have open items (Inspectors) or open folder
views (Explorers). With a unique Tag the Click() will fire only in that one
Inspector or Explorer.

--
Ken Slovak
[MVP - Outlook]
http://www.slovaktech.com
Author: Professional Programming Outlook 2007.
Reminder Manager, Extended Reminders, Attachment Options.
http://www.slovaktech.com/products.htm


"Matt" wrote in message
...
My commandbar was set as temporary but the button was not. Is this way
correct:

button_1 = CType(newToolBar.Controls.Add(1, 1, Nothing, Nothing, True),
Office.CommandBarButton)

?


Ads