Select to view content in your preferred language

Code to add a layer to Arcmap from a prompted list

427
1
11-17-2010 02:49 AM
StuartNicholls
New Contributor
Hello,
I am new to all this and as you can tell from the question know nothing about VBA etc... so please be gentle.
What i'm after is a bit of sample code that i can assign to what i assume will be a 'combobox' UIcontrol, so when clicking the button the user gets a list (predefined) and then that particular choice (in this case layer) is added to arcmap.
I already have the code for adding a layer into Arcmap. I just want to be able to combine it with a selection choice.
I know this is probably very simple 'Case Selection' code, but any help would be much appreciated.
Regards
StuartN
0 Kudos
1 Reply
SteveFang
Deactivated User
I assume you have an UICombobox set up.  So I can give you the abbreviated version.

1) In the MxDocument_OpenDocument event, add the layer names to your combobox control.
2) Ensure your add layer sub routine takes in a paramenter, layer name.
3) In your ComboBox_SelectionChange event, call your sub routine with the currently selected layername.

That's the basics, you can get more fancy with the code but that's up to you.  Good luck.
0 Kudos