G
geejay
I have this code:
namespace VisioAddIn1
{
public partial class ThisAddIn
{
private Microsoft.Office.Core.CommandBar CustomToolCommandBar;
private Microsoft.Office.Core.CommandBarComboBox myCombo;
private void ThisAddIn_Startup(object sender, System.EventArgs e)
{
CustomToolCommandBar =
((Office.CommandBars)this.Application.CommandBars).Add(
"My Custom Tool Bar", Office.MsoBarPosition.msoBarTop,
false, true) as Office.CommandBar;
myCombo =
(Microsoft.Office.Core.CommandBarComboBox)CustomToolCommandBar.Controls.Add
(Microsoft.Office.Core.MsoControlType.msoControlComboBox,
missing, missing, missing, true);
myCombo.Style = Microsoft.Office.Core.MsoComboStyle.msoComboLabel;
myCombo.Caption = "Test Combo";
myCombo.Tag = "TESTCOMBO";
myCombo.AddItem("One", 1);
myCombo.AddItem("Two", 2);
myCombo.AddItem("Three", 3);
myCombo.Visible = true;
myCombo.Change += new
Microsoft.Office.Core._CommandBarComboBoxEvents_ChangeEventHandler(myCombo_Change);
}
void myCombo_Change(Office.CommandBarComboBox Ctrl)
{
}
private void ThisAddIn_Shutdown(object sender, System.EventArgs e)
{
}
#region VSTO generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InternalStartup()
{
this.Startup += new System.EventHandler(ThisAddIn_Startup);
this.Shutdown += new System.EventHandler(ThisAddIn_Shutdown);
}
#endregion
}
}
But the combobox, when changed, does not fire the event.
What's the deal? Are there any alternatives/work arounds?
I don't really need a ComboBox, I would prefer a simple drop down.
Thanks for any help
namespace VisioAddIn1
{
public partial class ThisAddIn
{
private Microsoft.Office.Core.CommandBar CustomToolCommandBar;
private Microsoft.Office.Core.CommandBarComboBox myCombo;
private void ThisAddIn_Startup(object sender, System.EventArgs e)
{
CustomToolCommandBar =
((Office.CommandBars)this.Application.CommandBars).Add(
"My Custom Tool Bar", Office.MsoBarPosition.msoBarTop,
false, true) as Office.CommandBar;
myCombo =
(Microsoft.Office.Core.CommandBarComboBox)CustomToolCommandBar.Controls.Add
(Microsoft.Office.Core.MsoControlType.msoControlComboBox,
missing, missing, missing, true);
myCombo.Style = Microsoft.Office.Core.MsoComboStyle.msoComboLabel;
myCombo.Caption = "Test Combo";
myCombo.Tag = "TESTCOMBO";
myCombo.AddItem("One", 1);
myCombo.AddItem("Two", 2);
myCombo.AddItem("Three", 3);
myCombo.Visible = true;
myCombo.Change += new
Microsoft.Office.Core._CommandBarComboBoxEvents_ChangeEventHandler(myCombo_Change);
}
void myCombo_Change(Office.CommandBarComboBox Ctrl)
{
}
private void ThisAddIn_Shutdown(object sender, System.EventArgs e)
{
}
#region VSTO generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InternalStartup()
{
this.Startup += new System.EventHandler(ThisAddIn_Startup);
this.Shutdown += new System.EventHandler(ThisAddIn_Shutdown);
}
#endregion
}
}
But the combobox, when changed, does not fire the event.
What's the deal? Are there any alternatives/work arounds?
I don't really need a ComboBox, I would prefer a simple drop down.
Thanks for any help