Shapefile created with addin attributes blank until exiting arcmap.  Help

Discussion created by Bob50 on Jan 29, 2014
Latest reply on Jan 30, 2014 by Hornbydd
I have created a shapefile using the code below.  The addin tosses no errors and the shapefiles show up in Arccatalog with the geography viewable in the preview window.  However if you preview the table the attribute items are listed but no attributes populated.  If I exit the arcmap with the add in low and behold the attributes get populated.  This code has worked before using vb and arcobjects from withing arcmap converting it to a ARCGIS addin now using  any suggestions

Public Sub ExportFc_Arc(ByVal txtType As String, ByVal txtAco As String)
        On Error GoTo ErrorHandler
        'Export selected Arc features to a new shapefile
        Dim pFLayer As IFeatureLayer
        Dim pFc As IFeatureClass
        Dim pInFeatureClassName As IFeatureClassName
        Dim pDataset As IDataset
        Dim pInDSName As IDatasetName
        Dim pFSel As IFeatureSelection
        Dim pSelSet As ISelectionSet
        Dim pFeatureClassName As IFeatureClassName
        Dim pOutDatasetName As IDatasetName
        Dim pWorkspaceName As IWorkspaceName
        Dim pExportOp As IExportOperation

        'Get the first layer in the map to be exported
        pdoc = My.ArcMap.Document
        pFLayer = pdoc.FocusMap.Layer(intArcLocation)
        pFc = pFLayer.FeatureClass

        'Get the Featureclassname from the featureclass
        pDataset = pFc
        pInFeatureClassName = pDataset.FullName
        pInDSName = pInFeatureClassName

        'Get the selected features
        pFSel = pFLayer
        pSelSet = pFSel.SelectionSet

        'Define the output featureclass
        'give it the name of the input feature class + exp
        pFeatureClassName = New FeatureClassName
        pOutDatasetName = pFeatureClassName
        pOutDatasetName.Name = txtType & "Arc" & "_" & txtAco
        pWorkspaceName = New WorkspaceName
        pWorkspaceName.PathName = "\\something\assessor\GIS\SegProgram"
        pWorkspaceName.WorkspaceFactoryProgID = "esriCore.shapefileworkspacefactory.1"
        pOutDatasetName.WorkspaceName = pWorkspaceName
        'Give the output shapefile the same props as the input dataset
        pFeatureClassName.FeatureType = pFc.FeatureType
        pFeatureClassName.ShapeType = pFc.ShapeType
        pFeatureClassName.ShapeFieldName = pFc.ShapeFieldName

        'Export selected features
        pExportOp = New ExportOperation
        pExportOp.ExportFeatureClass(pInDSName, Nothing, pSelSet, Nothing, pOutDatasetName, 0)
                Exit Sub
        MsgBox("ExportFC_Arc Routine: " & Err.Description)
    End Sub