473,385 Members | 1,356 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

Strange Event Behavior (Controls with same tag value cause duplicate events)

Writing an Outlook AddIn with C#. For the user interface within Outlook I'm
adding matching pairs of Toolbar buttons and Menu items. All of the buttons
and menu items are wired up to send events to the same method (aka
delegate?). I use the Tag property within this method to determine what user
action is taking place. Very simple:

When adding toolbar button:
tbButton.Click += new
Microsoft.Office.Core._CommandBarButtonEvents_Clic kEventHandler(this.User_Click);

When adding Menu item:
MenuItem.Click += new
Microsoft.Office.Core._CommandBarButtonEvents_Clic kEventHandler(this.User_Click);

private void User_Click(CommandBarButton cmdButton, ref bool cancel)
{
MessageBox.Show(cmdButton.Tag);
}

Right now, all I've got is a simple dialog box to show me what's going on.

Strangely enough, if I use the same Tag for a Menu item and its
corresponding Toolbar button (This makes sense for me, since for any given
action, I don't really care if the user clicked a Menu or a Toolbar button)
I get two message boxes. Why two??? Surely, the delegate method is wired up
per object instance and not tracked by the Tag of the object? But seemingly,
when I click a Menu I get the event for the menu and the corresponding event
for the corresponding toolbar button as well! And vice versa. This is very
strange.

If I change the Tags so they don't match (e.g. Find|Toolbar and Find|Menu as
opposed to simply Find and Find) then I get the expected behavior. It's easy
enough for me to do this, and then strip out the basic tag value as follows:

MessageBox.Show("Viewpoint - " +
cmdButton.Tag.Remove(cmdButton.Tag.IndexOf("|")));

However, I'm puzzled by why this should all be necessary. Can you explain
this to me?

Thanks very much for your help!

- Joseph Geretz -
May 8 '06 #1
6 2243
Function as designed: the click even will fire for all controls with the
same value of the Tag property. If you don't want that, you must set the Tag
property to a unique strign for each instance of a button/menu item.
You need to use different event handlers rather than try to differentiate
the originating buttons using the Tag property.

Dmitry Streblechenko (MVP)
http://www.dimastr.com/
OutlookSpy - Outlook, CDO
and MAPI Developer Tool

"Joseph Geretz" <jg*****@nospam.com> wrote in message
news:uK**************@TK2MSFTNGP05.phx.gbl...
Writing an Outlook AddIn with C#. For the user interface within Outlook
I'm adding matching pairs of Toolbar buttons and Menu items. All of the
buttons and menu items are wired up to send events to the same method (aka
delegate?). I use the Tag property within this method to determine what
user action is taking place. Very simple:

When adding toolbar button:
tbButton.Click += new
Microsoft.Office.Core._CommandBarButtonEvents_Clic kEventHandler(this.User_Click);

When adding Menu item:
MenuItem.Click += new
Microsoft.Office.Core._CommandBarButtonEvents_Clic kEventHandler(this.User_Click);

private void User_Click(CommandBarButton cmdButton, ref bool cancel)
{
MessageBox.Show(cmdButton.Tag);
}

Right now, all I've got is a simple dialog box to show me what's going on.

Strangely enough, if I use the same Tag for a Menu item and its
corresponding Toolbar button (This makes sense for me, since for any given
action, I don't really care if the user clicked a Menu or a Toolbar
button) I get two message boxes. Why two??? Surely, the delegate method is
wired up per object instance and not tracked by the Tag of the object? But
seemingly, when I click a Menu I get the event for the menu and the
corresponding event for the corresponding toolbar button as well! And vice
versa. This is very strange.

If I change the Tags so they don't match (e.g. Find|Toolbar and Find|Menu
as opposed to simply Find and Find) then I get the expected behavior. It's
easy enough for me to do this, and then strip out the basic tag value as
follows:

MessageBox.Show("Viewpoint - " +
cmdButton.Tag.Remove(cmdButton.Tag.IndexOf("|")));

However, I'm puzzled by why this should all be necessary. Can you explain
this to me?

Thanks very much for your help!

- Joseph Geretz -

May 8 '06 #2
Hi Dmitry,

Thanks for your advice.
Function as designed: the click even will fire for all controls with the
same value of the Tag property. If you don't want that, you must set the
Tag property to a unique strign for each instance of a button/menu item.
OK, this is no problem. I've essentially done this, in order to workaround
what I observed. I'm glad to hear though, that the events are working
according to spec. BTW, can you give me a link to where this is documented?
I've always perceived the Tag property as a data bucket for developer's
convenience. It surprises me to hear that internal events are firing (or
not) based on the value in the Tag property.
You need to use different event handlers rather than try to differentiate
the originating buttons using the Tag property.
Are you saying that the way I'm wiring this up is fundamentally problematic?
Or just that I need to be careful to implement unique Tag properties in
order to facillitate this approach?

Thanks for your help,

- Joe Geretz -

"Dmitry Streblechenko" <dm****@dimastr.com> wrote in message
news:O0**************@TK2MSFTNGP04.phx.gbl... Function as designed: the click even will fire for all controls with the
same value of the Tag property. If you don't want that, you must set the
Tag property to a unique strign for each instance of a button/menu item.
You need to use different event handlers rather than try to differentiate
the originating buttons using the Tag property.

Dmitry Streblechenko (MVP)
http://www.dimastr.com/
OutlookSpy - Outlook, CDO
and MAPI Developer Tool

"Joseph Geretz" <jg*****@nospam.com> wrote in message
news:uK**************@TK2MSFTNGP05.phx.gbl...
Writing an Outlook AddIn with C#. For the user interface within Outlook
I'm adding matching pairs of Toolbar buttons and Menu items. All of the
buttons and menu items are wired up to send events to the same method
(aka delegate?). I use the Tag property within this method to determine
what user action is taking place. Very simple:

When adding toolbar button:
tbButton.Click += new
Microsoft.Office.Core._CommandBarButtonEvents_Clic kEventHandler(this.User_Click);

When adding Menu item:
MenuItem.Click += new
Microsoft.Office.Core._CommandBarButtonEvents_Clic kEventHandler(this.User_Click);

private void User_Click(CommandBarButton cmdButton, ref bool cancel)
{
MessageBox.Show(cmdButton.Tag);
}

Right now, all I've got is a simple dialog box to show me what's going
on.

Strangely enough, if I use the same Tag for a Menu item and its
corresponding Toolbar button (This makes sense for me, since for any
given action, I don't really care if the user clicked a Menu or a Toolbar
button) I get two message boxes. Why two??? Surely, the delegate method
is wired up per object instance and not tracked by the Tag of the object?
But seemingly, when I click a Menu I get the event for the menu and the
corresponding event for the corresponding toolbar button as well! And
vice versa. This is very strange.

If I change the Tags so they don't match (e.g. Find|Toolbar and Find|Menu
as opposed to simply Find and Find) then I get the expected behavior.
It's easy enough for me to do this, and then strip out the basic tag
value as follows:

MessageBox.Show("Viewpoint - " +
cmdButton.Tag.Remove(cmdButton.Tag.IndexOf("|")));

However, I'm puzzled by why this should all be necessary. Can you explain
this to me?

Thanks very much for your help!

- Joseph Geretz -


May 8 '06 #3
I don't think this is documented anywhere, this is just the way things
work... :-)
What I mean is that you need to use separate event handlers for different
buttons if they are supposed to do different things:

ButtonOne.Click += new
Microsoft.Office.Core._CommandBarButtonEvents_Clic kEventHandler(this.User_ButtonOneClick);
ButtonTwo.Click += new
Microsoft.Office.Core._CommandBarButtonEvents_Clic kEventHandler(this.User_ButtonTwoClick);

You can of course reuse the same event handler if, for example, both the
particular menu item and the toolbar button do the same thing.

Dmitry Streblechenko (MVP)
http://www.dimastr.com/
OutlookSpy - Outlook, CDO
and MAPI Developer Tool

"Joseph Geretz" <jg*****@nospam.com> wrote in message
news:uy**************@TK2MSFTNGP04.phx.gbl...
Hi Dmitry,

Thanks for your advice.
Function as designed: the click even will fire for all controls with the
same value of the Tag property. If you don't want that, you must set the
Tag property to a unique strign for each instance of a button/menu item.


OK, this is no problem. I've essentially done this, in order to workaround
what I observed. I'm glad to hear though, that the events are working
according to spec. BTW, can you give me a link to where this is
documented? I've always perceived the Tag property as a data bucket for
developer's convenience. It surprises me to hear that internal events are
firing (or not) based on the value in the Tag property.
You need to use different event handlers rather than try to differentiate
the originating buttons using the Tag property.


Are you saying that the way I'm wiring this up is fundamentally
problematic? Or just that I need to be careful to implement unique Tag
properties in order to facillitate this approach?

Thanks for your help,

- Joe Geretz -

"Dmitry Streblechenko" <dm****@dimastr.com> wrote in message
news:O0**************@TK2MSFTNGP04.phx.gbl...
Function as designed: the click even will fire for all controls with the
same value of the Tag property. If you don't want that, you must set the
Tag property to a unique strign for each instance of a button/menu item.
You need to use different event handlers rather than try to differentiate
the originating buttons using the Tag property.

Dmitry Streblechenko (MVP)
http://www.dimastr.com/
OutlookSpy - Outlook, CDO
and MAPI Developer Tool

"Joseph Geretz" <jg*****@nospam.com> wrote in message
news:uK**************@TK2MSFTNGP05.phx.gbl...
Writing an Outlook AddIn with C#. For the user interface within Outlook
I'm adding matching pairs of Toolbar buttons and Menu items. All of the
buttons and menu items are wired up to send events to the same method
(aka delegate?). I use the Tag property within this method to determine
what user action is taking place. Very simple:

When adding toolbar button:
tbButton.Click += new
Microsoft.Office.Core._CommandBarButtonEvents_Clic kEventHandler(this.User_Click);

When adding Menu item:
MenuItem.Click += new
Microsoft.Office.Core._CommandBarButtonEvents_Clic kEventHandler(this.User_Click);

private void User_Click(CommandBarButton cmdButton, ref bool cancel)
{
MessageBox.Show(cmdButton.Tag);
}

Right now, all I've got is a simple dialog box to show me what's going
on.

Strangely enough, if I use the same Tag for a Menu item and its
corresponding Toolbar button (This makes sense for me, since for any
given action, I don't really care if the user clicked a Menu or a
Toolbar button) I get two message boxes. Why two??? Surely, the delegate
method is wired up per object instance and not tracked by the Tag of the
object? But seemingly, when I click a Menu I get the event for the menu
and the corresponding event for the corresponding toolbar button as
well! And vice versa. This is very strange.

If I change the Tags so they don't match (e.g. Find|Toolbar and
Find|Menu as opposed to simply Find and Find) then I get the expected
behavior. It's easy enough for me to do this, and then strip out the
basic tag value as follows:

MessageBox.Show("Viewpoint - " +
cmdButton.Tag.Remove(cmdButton.Tag.IndexOf("|")));

However, I'm puzzled by why this should all be necessary. Can you
explain this to me?

Thanks very much for your help!

- Joseph Geretz -



May 8 '06 #4
>I don't think this is documented anywhere, this is just the way things
work... :-)
I was discussing this phenomenon with a colleague this afternoon. I'm a
little better versed in .NET / C#, but he has a wide range of experience
with other object oriented environments. Notwithstanding that this is the
way it works, neither of us could come up with any idea of why the Tag
property (of all things) would create any linkage between objects. Can
anyone comment on why this works the way it does?
ButtonOne.Click += new
Microsoft.Office.Core._CommandBarButtonEvents_Clic kEventHandler(this.User_ButtonOneClick);
ButtonTwo.Click += new
Microsoft.Office.Core._CommandBarButtonEvents_Clic kEventHandler(this.User_ButtonTwoClick);
Sure, that's one way to do it. Another way is to have one event handlers
with a Case statement to dispatch a function call to the appropriate
function, depending on the object which is clicked. The advantage I see to
this latter approach is that it makes it really easy to add a whole suite of
buttons through a centralized function.

In context, the AddIn which I am writing is basically a conduit, or linkage
between Outlook and an Application which I've written. As such, most of the
AddIn is simply creating Buttons and then dispatching button clicks to my
own application, along with information about the current context within
Outlook (i.e. current Contact, Appointment or Message). As such, much of the
code within the AddIn is simply involved with creating the AddIn interface
(Menus and Toolbar Buttons) and so that's where I'm leaning toward
optimization. By centralizing and generalizing the Menu / Button creation
code, I'm developing a programmatic structure which will eventually be
data-driven, for example, by an XML file. I'll be able to add new Menus and
Buttons simply by creating new entries in an XML file. This isn't something
which could be easily accommodated if each Menu / Button needed its own
dedicated event handler.

- Joe Geretz -

"Dmitry Streblechenko" <dm****@dimastr.com> wrote in message
news:OS**************@TK2MSFTNGP02.phx.gbl...I don't think this is documented anywhere, this is just the way things
work... :-)
What I mean is that you need to use separate event handlers for different
buttons if they are supposed to do different things:

ButtonOne.Click += new
Microsoft.Office.Core._CommandBarButtonEvents_Clic kEventHandler(this.User_ButtonOneClick);
ButtonTwo.Click += new
Microsoft.Office.Core._CommandBarButtonEvents_Clic kEventHandler(this.User_ButtonTwoClick);

You can of course reuse the same event handler if, for example, both the
particular menu item and the toolbar button do the same thing.

Dmitry Streblechenko (MVP)
http://www.dimastr.com/
OutlookSpy - Outlook, CDO
and MAPI Developer Tool

"Joseph Geretz" <jg*****@nospam.com> wrote in message
news:uy**************@TK2MSFTNGP04.phx.gbl...
Hi Dmitry,

Thanks for your advice.
Function as designed: the click even will fire for all controls with the
same value of the Tag property. If you don't want that, you must set the
Tag property to a unique strign for each instance of a button/menu item.


OK, this is no problem. I've essentially done this, in order to
workaround what I observed. I'm glad to hear though, that the events are
working according to spec. BTW, can you give me a link to where this is
documented? I've always perceived the Tag property as a data bucket for
developer's convenience. It surprises me to hear that internal events are
firing (or not) based on the value in the Tag property.
You need to use different event handlers rather than try to
differentiate the originating buttons using the Tag property.


Are you saying that the way I'm wiring this up is fundamentally
problematic? Or just that I need to be careful to implement unique Tag
properties in order to facillitate this approach?

Thanks for your help,

- Joe Geretz -

"Dmitry Streblechenko" <dm****@dimastr.com> wrote in message
news:O0**************@TK2MSFTNGP04.phx.gbl...
Function as designed: the click even will fire for all controls with the
same value of the Tag property. If you don't want that, you must set the
Tag property to a unique strign for each instance of a button/menu item.
You need to use different event handlers rather than try to
differentiate the originating buttons using the Tag property.

Dmitry Streblechenko (MVP)
http://www.dimastr.com/
OutlookSpy - Outlook, CDO
and MAPI Developer Tool

"Joseph Geretz" <jg*****@nospam.com> wrote in message
news:uK**************@TK2MSFTNGP05.phx.gbl...
Writing an Outlook AddIn with C#. For the user interface within Outlook
I'm adding matching pairs of Toolbar buttons and Menu items. All of the
buttons and menu items are wired up to send events to the same method
(aka delegate?). I use the Tag property within this method to determine
what user action is taking place. Very simple:

When adding toolbar button:
tbButton.Click += new
Microsoft.Office.Core._CommandBarButtonEvents_Clic kEventHandler(this.User_Click);

When adding Menu item:
MenuItem.Click += new
Microsoft.Office.Core._CommandBarButtonEvents_Clic kEventHandler(this.User_Click);

private void User_Click(CommandBarButton cmdButton, ref bool cancel)
{
MessageBox.Show(cmdButton.Tag);
}

Right now, all I've got is a simple dialog box to show me what's going
on.

Strangely enough, if I use the same Tag for a Menu item and its
corresponding Toolbar button (This makes sense for me, since for any
given action, I don't really care if the user clicked a Menu or a
Toolbar button) I get two message boxes. Why two??? Surely, the
delegate method is wired up per object instance and not tracked by the
Tag of the object? But seemingly, when I click a Menu I get the event
for the menu and the corresponding event for the corresponding toolbar
button as well! And vice versa. This is very strange.

If I change the Tags so they don't match (e.g. Find|Toolbar and
Find|Menu as opposed to simply Find and Find) then I get the expected
behavior. It's easy enough for me to do this, and then strip out the
basic tag value as follows:

MessageBox.Show("Viewpoint - " +
cmdButton.Tag.Remove(cmdButton.Tag.IndexOf("|")));

However, I'm puzzled by why this should all be necessary. Can you
explain this to me?

Thanks very much for your help!

- Joseph Geretz -



May 9 '06 #5
> >I don't think this is documented anywhere, this is just the way things
work... :-)
Hmm, this is not the way it works in a universal sense at all.

Simple Windows form application; Created two buttons. Wired them up to the
same event handler, Button_Click. Gave each one the same Tag. (Code extract
below.) This works as I expect. Clicking on either button generates one, and
only one, callback to the event handler. So why the weird behavior in
Outlook? Is it *Outlook* which creates the linkage between Menu Items and
Toolbar buttons with the same Tag property? Hmm...

So, back to my AddIn project. I implemented two separate event handlers; one
for Menu Items and one for Toolbar Buttons. I went back and reset the Tags
back to their matching values. Clicked on a menu item - sure enough; two
events are fired.

So it seems clear to me that it is after all, *Outlook* which implements the
bizarre behavior by cycling through the Menu Items and Toolbar buttons and
clicking all those with matching Tag properties, every time a Menu or Button
is clicked. Now why in the world would it do something like that?

Very strange...

- Joe Geretz -

//
// button1
//
this.button1.Location = new System.Drawing.Point(91, 32);
this.button1.Name = "button1";
this.button1.Size = new System.Drawing.Size(75, 23);
this.button1.TabIndex = 0;
this.button1.Tag = "X";
this.button1.Text = "button1";
this.button1.UseVisualStyleBackColor = true;
this.button1.Click += new System.EventHandler(this.Button_Click);
//
// button2
//
this.button2.Location = new System.Drawing.Point(91, 61);
this.button2.Name = "button2";
this.button2.Size = new System.Drawing.Size(75, 23);
this.button2.TabIndex = 1;
this.button2.Tag = "X";
this.button2.Text = "button2";
this.button2.UseVisualStyleBackColor = true;
this.button2.Click += new System.EventHandler(this.Button_Click);

"Joseph Geretz" <jg*****@nospam.com> wrote in message
news:eW**************@TK2MSFTNGP05.phx.gbl...I don't think this is documented anywhere, this is just the way things
work... :-)


I was discussing this phenomenon with a colleague this afternoon. I'm a
little better versed in .NET / C#, but he has a wide range of experience
with other object oriented environments. Notwithstanding that this is the
way it works, neither of us could come up with any idea of why the Tag
property (of all things) would create any linkage between objects. Can
anyone comment on why this works the way it does?
ButtonOne.Click += new
Microsoft.Office.Core._CommandBarButtonEvents_Clic kEventHandler(this.User_ButtonOneClick);
ButtonTwo.Click += new
Microsoft.Office.Core._CommandBarButtonEvents_Clic kEventHandler(this.User_ButtonTwoClick);


Sure, that's one way to do it. Another way is to have one event handlers
with a Case statement to dispatch a function call to the appropriate
function, depending on the object which is clicked. The advantage I see to
this latter approach is that it makes it really easy to add a whole suite
of buttons through a centralized function.

In context, the AddIn which I am writing is basically a conduit, or
linkage between Outlook and an Application which I've written. As such,
most of the AddIn is simply creating Buttons and then dispatching button
clicks to my own application, along with information about the current
context within Outlook (i.e. current Contact, Appointment or Message). As
such, much of the code within the AddIn is simply involved with creating
the AddIn interface (Menus and Toolbar Buttons) and so that's where I'm
leaning toward optimization. By centralizing and generalizing the Menu /
Button creation code, I'm developing a programmatic structure which will
eventually be data-driven, for example, by an XML file. I'll be able to
add new Menus and Buttons simply by creating new entries in an XML file.
This isn't something which could be easily accommodated if each Menu /
Button needed its own dedicated event handler.

- Joe Geretz -

"Dmitry Streblechenko" <dm****@dimastr.com> wrote in message
news:OS**************@TK2MSFTNGP02.phx.gbl...
I don't think this is documented anywhere, this is just the way things
work... :-)
What I mean is that you need to use separate event handlers for different
buttons if they are supposed to do different things:

ButtonOne.Click += new
Microsoft.Office.Core._CommandBarButtonEvents_Clic kEventHandler(this.User_ButtonOneClick);
ButtonTwo.Click += new
Microsoft.Office.Core._CommandBarButtonEvents_Clic kEventHandler(this.User_ButtonTwoClick);

You can of course reuse the same event handler if, for example, both the
particular menu item and the toolbar button do the same thing.

Dmitry Streblechenko (MVP)
http://www.dimastr.com/
OutlookSpy - Outlook, CDO
and MAPI Developer Tool

"Joseph Geretz" <jg*****@nospam.com> wrote in message
news:uy**************@TK2MSFTNGP04.phx.gbl...
Hi Dmitry,

Thanks for your advice.

Function as designed: the click even will fire for all controls with
the same value of the Tag property. If you don't want that, you must
set the Tag property to a unique strign for each instance of a
button/menu item.

OK, this is no problem. I've essentially done this, in order to
workaround what I observed. I'm glad to hear though, that the events are
working according to spec. BTW, can you give me a link to where this is
documented? I've always perceived the Tag property as a data bucket for
developer's convenience. It surprises me to hear that internal events
are firing (or not) based on the value in the Tag property.

You need to use different event handlers rather than try to
differentiate the originating buttons using the Tag property.

Are you saying that the way I'm wiring this up is fundamentally
problematic? Or just that I need to be careful to implement unique Tag
properties in order to facillitate this approach?

Thanks for your help,

- Joe Geretz -

"Dmitry Streblechenko" <dm****@dimastr.com> wrote in message
news:O0**************@TK2MSFTNGP04.phx.gbl...
Function as designed: the click even will fire for all controls with
the same value of the Tag property. If you don't want that, you must
set the Tag property to a unique strign for each instance of a
button/menu item.
You need to use different event handlers rather than try to
differentiate the originating buttons using the Tag property.

Dmitry Streblechenko (MVP)
http://www.dimastr.com/
OutlookSpy - Outlook, CDO
and MAPI Developer Tool

"Joseph Geretz" <jg*****@nospam.com> wrote in message
news:uK**************@TK2MSFTNGP05.phx.gbl...
> Writing an Outlook AddIn with C#. For the user interface within
> Outlook I'm adding matching pairs of Toolbar buttons and Menu items.
> All of the buttons and menu items are wired up to send events to the
> same method (aka delegate?). I use the Tag property within this method
> to determine what user action is taking place. Very simple:
>
> When adding toolbar button:
> tbButton.Click += new
> Microsoft.Office.Core._CommandBarButtonEvents_Clic kEventHandler(this.User_Click);
>
> When adding Menu item:
> MenuItem.Click += new
> Microsoft.Office.Core._CommandBarButtonEvents_Clic kEventHandler(this.User_Click);
>
> private void User_Click(CommandBarButton cmdButton, ref bool cancel)
> {
> MessageBox.Show(cmdButton.Tag);
> }
>
> Right now, all I've got is a simple dialog box to show me what's going
> on.
>
> Strangely enough, if I use the same Tag for a Menu item and its
> corresponding Toolbar button (This makes sense for me, since for any
> given action, I don't really care if the user clicked a Menu or a
> Toolbar button) I get two message boxes. Why two??? Surely, the
> delegate method is wired up per object instance and not tracked by the
> Tag of the object? But seemingly, when I click a Menu I get the event
> for the menu and the corresponding event for the corresponding toolbar
> button as well! And vice versa. This is very strange.
>
> If I change the Tags so they don't match (e.g. Find|Toolbar and
> Find|Menu as opposed to simply Find and Find) then I get the expected
> behavior. It's easy enough for me to do this, and then strip out the
> basic tag value as follows:
>
> MessageBox.Show("Viewpoint - " +
> cmdButton.Tag.Remove(cmdButton.Tag.IndexOf("|")));
>
> However, I'm puzzled by why this should all be necessary. Can you
> explain this to me?
>
> Thanks very much for your help!
>
> - Joseph Geretz -
>



May 9 '06 #6
> >I don't think this is documented anywhere, this is just the way things
work... :-)

It is documented in various places, e.g. http://msdn2.microsoft.com/en-US/library/0batekf4.aspx:

"You must set the Tag property on your controls when you add event handlers. Office uses the Tag property to keep track of event handlers for a specific CommandBarControl. If the Tag property is blank, the events are not handled properly."

Also, without explanation, in the sample code at http://msdn2.microsoft.com/en-US/library/ms268864.aspx
Hmm, this is not the way it works in a universal sense at all.


Right, this behavior is specific to Office add-ins.

--
Sue Mosher, Outlook MVP
Author of Configuring Microsoft Outlook 2003
http://www.turtleflock.com/olconfig/index.htm
and Microsoft Outlook Programming - Jumpstart for
Administrators, Power Users, and Developers
http://www.outlookcode.com/jumpstart.aspx

May 10 '06 #7

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Jonathan Yong | last post by:
I observe a very weird behavior when dynamically create web control and bind events to it. Create a C# ASP.NET application, Put a PlaceHolder and Textbox onto the Web form, and try with the 4...
0
by: PJ | last post by:
I have several dropdownlist controls in a placeholder on my form. Certain events will show this place holder and populate the values of the items collection of the dropdownlist controls. A...
8
by: Donald Xie | last post by:
Hi, I noticed an interesting effect when working with controls that are dynamically loaded. For instance, on a web form with a PlaceHolder control named ImageHolder, I dynamically add an image...
7
by: Tyler Foreman | last post by:
Hello, I have a strange problem that occurs every so often in my application. It usually takes place when I hide one form and activate another. What happens is I get the following exception:...
0
by: Demetri | last post by:
I have created a web control that can be rendered as either a linkbutton or a button. It is a ConfirmButton control that allows a developer to force a user to confirm if they intended to click it...
3
by: senfo | last post by:
I developed a Windows control in VS 2005 that inherits from the PictureBox Control that adds the ability to select images in a Windows application. It is, however, experiencing a strange issue...
19
by: Daniela Roman | last post by:
Hello, I try to fire an event under a button click event and maybe anybody can give a clue please. I have let's say a WEB grid with PageIndexChanged event: private void...
0
MMcCarthy
by: MMcCarthy | last post by:
VBA is described as an Event driven programming language. What is meant by this? Access, like most Windows programs, is an event driven application. This means that nothing happens unless it is...
12
by: Tom Bean | last post by:
I am trying to display a ContextMenuStrip when a user right-clicks on an item in a ListView and have encountered a something that seems strange to me. When the ListView is initially populated,...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.