Dim strName As String = "points.shp" Dim pSFactory As IWorkspaceFactory = New ShapefileWorkspaceFactory Dim pWS As IWorkspace = pSFactory.OpenFromFile("F:\data", m_application.hWnd) 'This is a network drive Dim pFWS As IFeatureWorkspace = pWS 'QI Dim pFC As IFeatureClass = pFWS.OpenFeatureClass(strName) Dim pPtLayer As IFeatureLayer = New FeatureLayer pPtLayer.FeatureClass = pFC pPtLayer.Name = "Points" pMxDoc.FocusMap.AddLayer(pPtLayer)
Dim pDL As IDataLayer2 = pPtLayer 'QI pDL.Disconnect() 'Learned about adding these 2 lines from similar postings in the forums pMxDoc.FocusMap.DeleteLayer(pPtLayer) pMxDoc.UpdateContents() pMxDoc.ActiveView.Refresh()
Solved! Go to Solution.
Dim pGPU As IGPUtilities2 = New GPUtilities pGPU.RemoveInternalLayer(pTELayer.Name)
Dim pGPU As IGPUtilities2 = New GPUtilities pGPU.RemoveInternalLayer(pTELayer.Name)