titocatala

Activate Layers with checkBoxList

Discussion created by titocatala on Dec 11, 2012
Hello again,
I'm trying to do a code to activate a Layers that are in a checkboxlist, the code that I'm trying to use is this:
 Private Sub chxActivated_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles chxActivated.SelectedIndexChanged
       
        MxDoc = My.ArcMap.Document
        Maps = MxDoc.Maps


        If chxActivated.SelectedItem = True Then
            GxLayer.Layer.Visible = True HERE IS THE PROBLEM
            MxDoc.UpdateContents()
            MxDoc.ActiveView.Refresh()
         End If


I add the layers with this code
Private Sub cmdInformation_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmdInformation.Click
        MxDoc = My.ArcMap.Document
        Map = MxDoc.FocusMap
        'new layer
        GxLayer = New GxLayer
        GxFile = GxLayer
        'Layer file path
        GxFile.Path = "C:\Layers\Aditional Information.lyr"
        'Add the new layer to ArcMap
        Map.AddLayer(GxLayer.Layer)
        'Add the layer invisible
        GxLayer.Layer.Visible = False
        'Refresh the view
        MxDoc.ActiveView.Refresh()
    End Sub


Thank you!

Outcomes