Unable to see the objects in the map through arcengine code

Discussion created by cpmikey21 on Apr 30, 2010
Latest reply on May 4, 2010 by jeffmatson
Hi everyone,

Very new to GIS so bear with my description of the problem.  I am coding in VS 2008 in VB.  I am trying to load up a geodatabase and show the contents on a mapcontrol, but the objects don't appear in the control when I add it through code.  I add the geodatabase through the Add Data toolbar button and the features appear on the map. 
My code follows and the geodatabase is attached.  Can anyone notice anything wrong with what I am doing?

        Dim objWorkspaceFactory As IWorkspaceFactory2
        Dim objGDBFeatureWorkspace As IFeatureWorkspace
        Dim objGDBFeatureLayer As IFeatureLayer

        objWorkspaceFactory = New FileGDBWorkspaceFactory
        objGDBFeatureLayer = New FeatureLayer

        objGDBFeatureWorkspace = CType(objWorkspaceFactory.OpenFromFile(strFilePath, 0), IFeatureWorkspace)
        objGDBFeatureLayer.FeatureClass = objGDBFeatureWorkspace.OpenFeatureClass("Site_Lots_TEST")
        objGDBFeatureLayer.Name = objGDBFeatureLayer.FeatureClass.AliasName