通过运行以下代码创建布局,但当切换到该布局时,跳出错误信息: “内部错误:!dbsymblk.cpp@588:eNullObjectId” 。
是何原因?如何解决?望高人指点!
Public Sub CreatLayouts(ByVal VPNo As Double)
Dim db As Database = HostApplicationServices.WorkingDatabase
Dim acLayoutName As String = "VP" & VPNo
Using Trans As Transaction = db.TransactionManager.StartTransaction()
Dim acLayout As New Layout
acLayout.LayoutName = acLayoutName
Dim acLayoutDic As DBDictionary = Trans.GetObject(db.LayoutDictionaryId, OpenMode.ForWrite)
acLayoutDic.SetAt(acLayoutName, acLayout)
Trans.AddNewlyCreatedDBObject(acLayout, True)
Trans.Commit()
End Using
End Sub