Combobox malfunctioning in toolbar

Started by nir, January 29, 2012, 11:18:06 AM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

nir

Hi all,
I'm trying to place a simple combo control in my add-in menu, roughly like so:
"
        CommandBar VisioToolbar;
        CommandBarComboBox btnSelect;

        btnSelect =   (CommandBarComboBox)VisioToolbar.Controls.Add(MsoControlType.msoControlComboBox,
omissing, omissing, omissing, omissing);
           
            btnSelect.DropDownLines = 2;
            btnSelect.Text = "Select";
            btnSelect.Style = MsoComboStyle.msoComboNormal;
            btnSelect.Caption = "Select";
            btnSelect.Change += new   _CommandBarComboBoxEvents_ChangeEventHandler(btnSelect_Change);
            btnSelect.AddItem("selection 1", omissing);
            btnSelect.AddItem("selection 2", omissing);
...

        void btnSelect_Change(CommandBarComboBox Ctrl)
        { /* ... */ }
"

This code works fine prior to launching a 'new page' order.
Afterwords, the ' btnSelect_Change' is not called again.
Why is that and what can I do about it  ?
Thanx.
Nir Putter - software engineer.

Nikolay

Try setting "Tag" property to some unique value.
Like this:

btnSelect.Tag = "GodBlessVisioCommandBarArchitecture"


The related MSDN article (see "Maintaining references to command bar controls when contexts change")
http://msdn.microsoft.com/en-us/library/aa201791.aspx

nir

Quote from: Nikolay on January 29, 2012, 01:34:49 PM
Try setting "Tag" property to some unique value.
Like this:

btnSelect.Tag = "GodBlessVisioCommandBarArchitecture"


The related MSDN article (see "Maintaining references to command bar controls when contexts change")
http://msdn.microsoft.com/en-us/library/aa201791.aspx


It did'nt work.
Thanx anyway.
Nir Putter - software engineer.