Neil, thanks for the example. It seems like it would fix the issue but I'm still having an issue. When I run this code now, it tells me that the table can't be found (from the feature layer). Here is my code:Private Sub btnImportArcMap_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnImportArcMap.Click
Try
Dim pObjFactory As IObjectFactory = DirectCast(m_pApp, IObjectFactory)
Dim FileGDBType As Type = GetType(FileGDBWorkspaceFactoryClass)
Dim typeCLsID As String = FileGDBType.GUID.ToString("B")
Dim filename As String = "C:\Visualization.gdb\erasemepleaseBilling"
Dim filepath As String = System.IO.Path.GetDirectoryName(filename)
Dim pWorkspaceFactory As IWorkspaceFactory = DirectCast(pObjFactory.Create(typeCLsID), IWorkspaceFactory)
Dim pFeatureWorkspace As IFeatureWorkspace = DirectCast(pWorkspaceFactory.OpenFromFile(filepath, 0), IFeatureWorkspace)
Dim pFLayer As IFeatureLayer = DirectCast(pObjFactory.Create("esriCarto.FeatureLayer"), IFeatureLayer)
pFLayer.FeatureClass = pFeatureWorkspace.OpenFeatureClass(filename)
pFLayer.Name = pFLayer.FeatureClass.AliasName
Dim pBasicDocument As IBasicDocument = DirectCast(m_pApp.Document, IBasicDocument)
pBasicDocument.AddLayer(pFLayer)
pBasicDocument.UpdateContents()
Catch ex As Exception
MessageBox.Show(ex.Message)
End Try
End Sub
Can you tell me if there is something that I'm missing?Thanks!