null reference exception error RRS feed

  • Question

  • why am i getting a nulllreferenceexception was unhandled at the second line in the code

    Private Sub GetMap_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles GetMap.Click
            Dim objmap As MapPoint.Map
            MPC.NewMap(MapPoint.GeoMapRegion.geoMapNorthAmerica) ------ error here
            objmap = MPC.ActiveMap

        End Sub
    Tuesday, August 11, 2009 4:38 AM


  • The null reference exception occures when you have not initialized your object (means the object you are refering is null).. if MPC is a objec then you may have not initialized it..

    :: Learning .NET ::
    • Marked as answer by rowter Tuesday, August 11, 2009 2:39 PM
    Tuesday, August 11, 2009 5:11 AM