1

Does anyone have code in C# to add a new data frame (map) to an MXD? I have an MXD created in ArcMap 10.1 that has an existing data frame. I need to programmatically add a new data frame and populate it with several layers from a personal geodatabase. I'm using VS2010 with .Net 3.5. I have created a MultiItem that reads the names of folders that contain the PGDB files. After selecting a name from the list (which is populating correctly) it triggers OnSelChange. In that routine I need to create a data frame named based on the folder name selected from the MultiItem list. The name comes in just fine, but I'm stuck creating the new dataframe. I tried using IMaps.Create() but it doesn't add anything to the count of maps. I have tried then using IMaps.Add() but VS reports that Add is not defined for IMaps contrary to being described in the ArcObjects reference.

The only procedure I have found is the one written in VBA using ArcObjects 10. It seems rather convoluted given there are supposed to be functional methods for IMaps to do exactly what I need. Any help would be greatly appreciated.

  • This is strange... I'm unable to get the .Add() method as well and nothing pops up in Intellisense... Hard to believe that no one on the ESRI forums has mentioned this either... – Jason Miller Aug 27 '13 at 10:19
2

For some reason, the IMaps.Add() method is marked as hidden in COM. This also means that it is not shown in Intellisense. Any code using it will compile just fine, though.

| improve this answer | |

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.