Search code examples
c#esriarcobjectsicommandarcmap

How do I get the DropDown selection from a Command Button in ArcObjects?


I have a dropdown and a Icommand button in the same toolbar in ArcMap. I can't seem to get access to the dropdowns selection when I am using the command button.

How can I find the dropdown so I can find out what the user just selected?

Thanks

Scott


Solution

  • I found the Drop Down with this code... Then I dove a little Deeper to pull the dropdown out.

    var commandBars= m_application.Document.CommandBars;
               ESRI.ArcGIS.esriSystem.UID pUID = new UIDClass();
               pUID.Value = "{A6D2046E-F92C-440f-B54B-91899B4F667E}";
               var commmandItem = commandBars.Find(pUID, false, false);
    

    Then the Dropdown was at:

    (ComboBox)((LOSBaseCampExample.LOSSurroundBaseCampControl)(commmandItem.Command)).Controls[0])
    

    Note: LOSBaseCampExample.LOSSurroundBaseCampControl was the name of MY tool... Your will be different.