Addin ComboBox OnSelChange fires multiple times with messagebox

Discussion created by twhiteaker on Jan 20, 2011
Latest reply on Feb 17, 2013 by jongarrido
When I show a message box in the OnSelChange event of a ComboBox in an add-in, the OnSelChange event fires two more times, and it changes the selected item to the first item in the ComboBox.  Note that when I remove the line with the message box, it doesn't revert to the first item in the list, and the event only seems to be firing once.

Environment: Visual Studio 10, Windows 7 64-bit, ArcGIS 10.0, .NET 3.5, c#.

I used the ArcGIS Add-Ins Wizard to create the class.  The only other item in my add-in is a toolbar on which the combo box is placed. 

How do I prevent the event from firing multiple times? 

Here's the entire code from my combo box class.

using System;
using System.Collections.Generic;
using System.Text;
using System.IO;

namespace ComboBoxTest
    public class Combo1 : ESRI.ArcGIS.Desktop.AddIns.ComboBox
        private bool m_updating;

        public Combo1()
            m_updating = true;

            int firstCookie = Add("Items");

            for (int i = 1; i < 11; i++)

            m_updating = false;

        protected override void OnUpdate()
            Enabled = ArcMap.Application != null;

        protected override void OnSelChange(int cookie)
            if (m_updating == false)
                // Added reference to System.Windows.Forms



And here's Config.esriaddinx.

[HTML]<ESRI.Configuration xmlns="" xmlns:xsi="">
  <Description>This add-in tests for unwanted combo box selection when message boxes are shown in the OnSelChanged event.</Description>
  <Author>Tim Whiteaker</Author>
  <Company>The University of Texas at Austin</Company>
    <Target name="Desktop" version="10.0" />
  <AddIn language="CLR" library="ComboBoxTest.dll" namespace="ComboBoxTest">
        <ComboBox id="The_University_of_ComboBoxTest_Combo1" class="Combo1" message="Add-in command generated by Visual Studio project wizard." caption="Choose Number: " tip="Change the combo box item to show a message box." category="Add-In Controls" image="Images\Combo1.png" editable="false" sizeString="WWWWWWWWWW" showCaption="true" />
        <Toolbar id="The_University_of_ComboBoxTest_My_Toolbar" caption="My Toolbar" showInitially="true">
            <ComboBox refID="The_University_of_ComboBoxTest_Combo1" />