mkohlerpsl

Use esriArcMapUI.MxSelectionMenu in ArcEngine App

Discussion created by mkohlerpsl on May 8, 2013
I am creating an app for non gis users. Clerks in the Planning and Zoning Dept. Part of the requirements is to be able to select lots of parcels that define an overall polygon that will be used as a project boundary. Some of the times there are only 4 or 5 parcels and the workflow is just fine. Other times there are hundreds of parcels that need to be selected and this is where my issue lies. I've added the graphics creation tools, ie esriControls.ControlsNewPolygonTool and the select by graphics button built into ArcEngine. This works ok in theory but it is harder in practice. I've enabled arrow scrolling and a right-click pan so when they are drawing the graphic polygon they can zoom in and out and scroll around. Basically, I've created a viable option for the workflow.

What I would like to do and what I wanted to know, was how do I change the interactive selection method used by the selection tool. It seems to be stuck on Create New Selection. I would like to set it to Add to Current Selection. I tried opening the MXD that the map control uses and setting the Interactive Selection method there but the map control does not recgonize any change.

I had thought about calling the code like I would in arcmap

 

        Dim aMxd As IMxDocument = CType(My.ArcMap.Application.Document, IMxDocument)    'get arcmap document

        Dim mSelMenuUid As UID = New UIDClass()
        mSelMenuUid.Value = "{EB70D0AF-0FA4-11D3-9F82-00C04F6BC78E}"
        Dim pSelMenu As ICommandBar = My.ArcMap.Application.Document.CommandBars.Find(mSelMenuUid)

        Dim pSelMethodMenu As ICommandBar = pSelMenu.Item(7)
        Dim pRemoveSel As ICommandItem = pSelMethodMenu.Item(2)

        pRemoveSel.Execute()


This works just fine in ArcMap. When I try to implement the same thing in ArcEngine app I'm lost. I thought I could just put the selection menu in the ArcEngine app with

AxToolbarControl1.AddMenuItem("esriArcMapUI.MxSelectionMenu", -1, False, 1)

When I add this line, the menu shows up and when I try to click on it I get an error about protected memory. "Attempted to read or write protected memory. This is often an indication that other memory is corrupt." I've added a reference and import to my app for the ArcMapUI.

Don't know what else to try. Really, what I want to do is to set the Interactive Selection Method for the Map Control to be "Add to Current Selection" and be done with it.

HELP! LOL

Michael

Outcomes