I have a simple ArcMap Add-in that displays all featureclass names in a database inside of a ListBox. If I select a name or multiple names in the listbox, how can I drag and drop it in ArcMap? Just to give a quick summary, the purpose of this add-in is because the database has encrypted names and I have to show the "friendly names" in the ListBox control so I will use a special refrence table in SQL to populate the listbox with the friendly names.

  • Encrypted names? Can you give an example? – blah238 Feb 21 '13 at 19:48
  • @blah238 sorry I meant ArcMap not Catalog. I've corrected my question and tags. – DaBears Feb 21 '13 at 19:56
  • What? That wasn't my question at all. What do you mean by "encrypted names"? – blah238 Feb 21 '13 at 20:30
  • Wells Featureclass = G01P01L0023 in sde – DaBears Feb 21 '13 at 21:02
  • Well that's weird. – blah238 Feb 21 '13 at 21:20

This is just an idea and an alternative to drag 'n' drop. It sounds like you have a list box on a form that is being populated with friendly names. I'm guessing these will be simply text entries? Instead of trying to drag 'n' drop why not have a button that when clicked reads the selected items (your table names) in the list box, connects to the workspace and loads them into the map?

I would image that would be easier to implement unless drag 'n' drop is specifically required?

  • yes that approach does sound easier. if I were to use a button to load the layers into arcmap how do I get access to the activeview? – DaBears Feb 22 '13 at 14:01
  • In 10.1 VB .net it would be: Dim pMXDocument As IMxDocument pMXDocument = My.ArcMap.Document Dim pMap As IMap pMap = pMXDocument.FocusMap – Hornbydd Feb 22 '13 at 14:53
  • Thanks this worked for me and I was able to add layers from my addin to my arcmap session – DaBears Feb 22 '13 at 16:26

I think you need to implement IGxObject and display your objects in a GxContentsView. See the Catalog and CatalogUI library overviews.

Another possibility might be to use the IDataObjectHelper. See Richie Carmichael's blog post on this topic.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.