AnsweredAssumed Answered

vb.net - err: "object reference not set to an instance of an object"

Question asked by geonetadmin on Dec 30, 2010
Latest reply on Jan 3, 2011 by helenchu
Original User: helenchu

All,
I'm trying to write some code in vb.net.  I run into error right at the beginning.  The error is "object reference not set to an instance of an object".  What I tried to do is to have a button (for editing), that button will open a form with users' input.  What do I miss?  Thank you very much for your help.

This is what I have:
Button1.vb:

Protected Overrides Sub OnClick()
Dim myForm As New frmMyform
        myForm.Show()
End Sub

frmMyform.vb:

Public Class frmMyform
    Private m_application As ESRI.ArcGIS.Framework.IApplication 'replace m_PApp with m_application
    Private m_pDoc As ESRI.ArcGIS.ArcMapUI.IMxDocument
    Private m_pEditor As ESRI.ArcGIS.Editor.IEditor

Private Sub cmdBlkNum_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmdBlkNum.Click
     Dim pEditor As IEditor
     Dim pUID As New UID
     Dim pEditLayers As IEditLayers
     Dim pMap As IMap

     pUID.Value = "esriEditor.Editor"
     pEditor = m_application.FindExtensionByCLSID(pUID)
     MsgBox(pEditor.CurrentTask.Name)
    
end sub
end class

Attachments

Outcomes