question about null reference in VB2010

Discussion created by jihua816 on Jun 28, 2011
Latest reply on Jul 5, 2011 by agray1

I am upgrading a stand-alone window form application from VB2005 to VB2010.
I have a quick question when I compiled a window form application using vb.net 2010.
When I load the form, at the line of
pMap = m_pMxDoc.FocusMap

An error message said

System.NullReferenceException was unhandled
  Message=Object reference not set to an instance of an object.
I have defined in the class already
Private m_pApp As IApplication
Private m_pMxDoc As IMxDocument
Have you ever met this problem?

Does anyone see any sample GIS code in VB2010? I didn't see much sample scripts in VB2010 I can follow.


Thanks a lot for your help!