hylndr

Problem executing built-in command

Discussion created by hylndr on Dec 6, 2011
Latest reply on Dec 6, 2011 by Neil
Howdy All,
     Here's a quick one (I hope!)...  I'm working on a ArcMap add-in that has a form in it that has two buttons, one for "Clear Selection" and the othe for "Selecting features"...  I can get the "Clear Selection" to work, but can't seem to figure out how to get the Select Features" one to work...  Here is what I have for code:

    'Someplace in the solution these are defined and set...
    Public g_pMxDoc As IMxDocument
    Public g_application As IApplication

       .
       .
       .


    g_pMxDoc = My.ArcMap.Document
    g_application = My.ArcMap.Application

       .
       .
       .


   'In the form's code I have the following:
   Private Sub btnClearSelection_Click(sender As System.Object, e As System.EventArgs) Handles btnClearSelection.Click
        Dim pCommand As ICommand
        pCommand = New ControlsClearSelectionCommand
        pCommand.OnCreate(g_application)
        pCommand.OnClick()
    End Sub



   Private Sub btnSelectFeatures_Click(sender As System.Object, e As System.EventArgs) Handles btnSelectFeatures.Click
        Dim pCommand As ICommand
        pCommand = New ControlsSelectFeaturesToolClass
        pCommand.OnCreate(g_application)
        g_pMxDoc.CurrentTool = pCommand
        pCommand.OnClick()
    End Sub



When I "Click" the "Select" buttom, it ges through the code fine, but it does not let me select anything on the map...   The cursor doesn't change and the selection tool is presently set for select by box...  When I drag over features (form a box), nothing is selected

This is in an ArcMap 10 Add-in written in VB .Net

Current Environment:
ArcMap 10.0 Service Pack 3, ArcInfo license level
ArcObjects SDK, Service Pack 1
Visual Studio 2010 Professional, Service Pack 1
VB.Net


Any ideas as to what I did wrong and/or how to correct this????

Thanks in advance,
Kevin Orcutt

Outcomes