New to ArcObjects 10

458
4
Jump to solution
07-23-2013 10:51 AM
NeedHelp
New Contributor
Having trouble creating custom buttons for 10.0 from 9.3.
I know most of my code will work, but when I run the snippits:
GetMxDocumentFromArcMap & GetActiveVewFromArcMap both return Nothing.

So it's impossible to do anything further when you can't get a valid reference to the MxDoc or Active view.


My previous code used to have:
Private m_application As IApplication
But in 10.0 I get an error with that line and changed it to:
Private m_application As ESRI.ArcGIS.Framework.IApplication

Could somebody post some sample code or sample project to help me get started??

Thanks
0 Kudos
1 Solution

Accepted Solutions
KenBuja
MVP Esteemed Contributor
What is the value that you're setting m_application to? If you're creating an Add-in, then you can use

Private m_application As ESRI.ArcGIS.Framework.IApplication = My.ArcMap.Application

View solution in original post

0 Kudos
4 Replies
NeedHelp
New Contributor
Still hoping to get a bit of help.

Even when I use the Snippet "GetMxDocument from ArcMap" Nothing gets returned.
Is there something basic I'm missing??
0 Kudos
KenBuja
MVP Esteemed Contributor
What is the value that you're setting m_application to? If you're creating an Add-in, then you can use

Private m_application As ESRI.ArcGIS.Framework.IApplication = My.ArcMap.Application
0 Kudos
NeedHelp
New Contributor

Private m_application As ESRI.ArcGIS.Framework.IApplication = My.ArcMap.Application

WOW... your awesome!!  That was exactly what the problem was.
Thanks so much.

Wonder if it's a common issue for new to '10 programmers, or just me 🙂
0 Kudos
KenBuja
MVP Esteemed Contributor
Glad to help. We all start as beginners!

Don't forget to click the check to mark the thread answered (and the up arrow to mark it as helpful).
0 Kudos