I am using a standalone form to get a feature layer and then put it in an open ArcMap project. It's a short code and it works in VBA, but I don't know why it wouldn't work in a VB.NET form. Here is the codePrivate Sub btnImportArcMap_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnImportArcMap.Click
Dim pMxDoc As IMxDocument
Dim pMap As IMap
pMxDoc = m_pApp.Document
pMap = pMxDoc.FocusMap
Dim pFLayer As IFeatureLayer = New FeatureLayer
Dim pFClass As IFeatureClass
Dim pGPUtilities As IGPUtilities = New GPUtilities
Try
pFClass = pGPUtilities.OpenFeatureClassFromString("C:\Visualization.gdb\temp")
pFLayer.FeatureClass = pFClass
pFLayer.Name = pFClass.AliasName
pMap.AddLayer (pFLayer)
pMxDoc.UpdateContents()
pMxDoc.ActiveView.Refresh()
Catch ex As Exception
MessageBox.Show (ex.Message)
End Try
MessageBox.Show ("Complete")
End SubI have a sub before this that calls the m_pApp as IApplication and opens a new ArcMap project. The problem with my code is at the pMap.AddLayer (pFLayer) part. Can anyone tell me what I need to add or change to this code?Thanks!