0 Replies Latest reply on Oct 1, 2012 1:00 PM by helenchu

    delete feature class

    helenchu
      My pdataset.delete no longer works.  I had no problem with it before.  Now I got "layer in use" error.  I know for a fact that layer should not be in use because it's a temp layer I create in the process of converting an annotation layer. 
      Thanks in advance for your help.



      Public Sub DeleteFeatureClass(ByVal pFWorkspace As IFeatureWorkspace, ByVal sFCName As String)
              Dim pFC As IFeatureClass
              Dim pDataSet As IDataset

              On Error Resume Next  ' suspend normal error handling.
              pFC = pFWorkspace.OpenFeatureClass(sFCName)

              On Error GoTo ErrorHandler  ' resume normal error handling.
              If Not pFC Is Nothing Then
                  pDataSet = pFC
                  If pDataSet.CanDelete Then
                      pDataSet.Delete()
                  End If
              End If

              Exit Sub

      ErrorHandler:
              MsgBox(Err.Description, vbInformation, "DeleteFeatureClass")
          End Sub