Is there any way to delete layouts from a sidedatabase? Using the Layout named dictionary instead of the layoutManager? I've been using the below code but it's not deleting the layout itself...
Public Shared Sub DeleteTab(ByVal MyFileCollection As MyFiles)
For Each AutoCadFile In MyFileCollection
Using ExistDatabase As New Database(False, True)
ExistDatabase.ReadDwgFile(AutoCadFile.SelectedFilePath, FileOpenMode.OpenForReadAndAllShare, False, Nothing)
ExistDatabase.CloseInput(True)
Using AcTrans As Transaction = ExistDatabase.TransactionManager.StartTransaction
Dim MyLayouts As DBDictionary = AcTrans.GetObject(ExistDatabase.LayoutDictionaryId, OpenMode.ForRead)
' Step through each named layout and Model
For Each item As DBDictionaryEntry In MyLayouts
If item.Key = "English_Metric" Then
Dim MyItem As DBObject = AcTrans.GetObject(item.Value, OpenMode.ForWrite)
MyItem.Erase(True)
End If
Next
ExistDatabase.SaveAs(AutoCadFile.SelectedFilePath, DwgVersion.Current)
AcTrans.Commit()
End Using
End Using
Next
End Sub