I'm coverting Hussein Nasser VB code to C# but I'm having problems.
it's from his session:
Extending ArcObjects with .NET (IGeometry) - 02 - Working with Layers
The Vb code works but my converted C# crashes
here is my onclick code from form1 : Form
ERROR ->
System.NullReferenceException: Object reference not set to an instance of
OCCURS during the Assignment of pMap.
private void button1_Click(object sender, EventArgs e)
{
IMxDocument pMxDoc = (IMxDocument)_application.Document;
IMap pMap = pMxDoc.FocusMap;
}
vb code :
Private _application As IApplication
Public Property ArcMapApplication() As IApplication
Get
Return _application
End Get
Set(ByVal value As IApplication)
_application = value
End Set
End Property
c# code:
private IApplication _application;
public IApplication ArcMapApplication
{
get { return _application; }
set { _application = value; }
}