Dale563056

Hi All-

I'm developing a Visio 2003 Addin using VSTO 2005SE with Visual Studio 2005 (C#)

I've worked on this issue for several days now and I'm having no luck. I've created a custom CommandBar that has 3 Buttons and 1 ComboBox. The CommandBarButton objects and the CommandBarComboBox object are all declared at the class level of the "Addin" class (ThisAddin). All of the Button Click events work as I would expect, but the Change event of the ComboBox never works. The same code works fine in MS Word & Excel.

If anyone has already dealt with this or has ideas please let me know - deadlines are slipping .

Thank you,

Dale Lundgren




Re: Visual Studio Tools for Office CommandBarComboBox Change Event

Cindy Meister

Hi Dale

Have you tried asking this in the Visio developer newsgroup The specialists there might have a better idea why the CommandBars object model might not be working the same way in Visio as in other Office apps

http://www.microsoft.com/communities/newsgroups/en-us/default.aspx dg=microsoft.public.visio.developer&cat=en_US_7dd7f818-5a21-4dac-938b-9ac892ab60f3&lang=en&cr=US






Re: Visual Studio Tools for Office CommandBarComboBox Change Event

Dale

Hi Cindy-

Thanks for the tip. Unfortunately, I posted to the Visio Developer group last week and there have been no responses. I'll give it another day or so to see what happens...

Dale






Re: Visual Studio Tools for Office CommandBarComboBox Change Event

John Yang - MSFT

Is there anyway we can see some of your sample code This could give us a better indication of what is going on.



Re: Visual Studio Tools for Office CommandBarComboBox Change Event

Dale

Hi John-

Thanks for the response. I have submitted the issue to Microsoft Developer Support. The best example I can give is to direct you to the Visio 2003 SDK "Flowchart" sample for C#. The sample adds two buttons to a custom CommandBar. If you modify the sample code to add a ComboBox to the CommandBar and treat it the same as the existing buttons, you'll see that the Change event doesn't fire. In the CustomCommandBar class:

Code Snippet

public void CreateCommandBar(Microsoft.Office.Interop.Visio.Application theApplication)

{

// Existing code here....

//

//

// Add a ComboBox to the CommandBar

myCombo = (CommandBarComboBox)currentCommandBar.Controls.Add(MsoControlType.msoControlDropdown, 1, "", 3, false);

myCombo.Caption = "Test Combo";

myCombo.Tag = "TESTCOMBO";

myCombo.AddItem("One", Type.Missing);

myCombo.AddItem("Two", Type.Missing);

myCombo.AddItem("Three", Type.Missing);

myCombo.Visible = true;

myCombo.Change += new _CommandBarComboBoxEvents_ChangeEventHandler(myCombo_Change);

}

void myCombo_Change(CommandBarComboBox Ctrl)

{

MessageBox.Show("Combo Text = " + Ctrl.Text);

}

Thanks again,

Dale