I am using an ARCGIS map control which has "Layers" of spatial data (i.e. Roads, Creeks, Rivers, etc.)
When I load the form and the map control, I want to create a Dynamic Table of Contents in the form of Check Boxes in order to control whether the Layers will be visible or not.
Can someone please supply a sample snippet of code that will create an array of check boxes?
Here is my code, but I'm getting errors regarding "Use the 'NEW' keyword..."
'GET THE NUMBER OF LAYERS FROM THE MapControl Dim NumLayers as Integer NumLayers = AxMapControl1.LayerCount 'CREATE NEW CHECKBOX CONTROL ARRAY Dim MyCheckboxes As New CheckBox() 'LOOP THROUGH THE LAYERS AND CREATE A CHECKBOX FOR EACH Dim i As Integer For i = 0 To NumLayers - 1 'if the number of layers is 5 our Layer array will be 0 to 4 'CYCLE THROUGH AND POPULATE CHECKBOXES MyCheckboxes(i).Visible = True MyCheckboxes(i).Checked = True MyCheckboxes(i).Text = AxMapControl1.Map.Layer(i).Name Next i
I know this is not correct, but am not sure how to do it...