Set CurrentLayout

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Can someone please tell me why I get an 'esetfailed' error? I must be missing something simple. Just before this sub I call another sub that changes the active document. ?? This is in AutioCAD 2011 w/ 64bit environment.
Public Shared Sub ActiveLayout(ByVal name As String)
Dim acDoc As Document = AcApp.DocumentManager.MdiActiveDocument
Dim Db As Database = HostApplicationServices.WorkingDatabase
Dim tdoclock As DocumentLock = acDoc.LockDocument
Dim layMgr As LayoutManager = LayoutManager.Current
Using acTrans As Transaction = Db.TransactionManager.StartTransaction()
Try
Autodesk.AutoCAD.ApplicationServices.Application.ShowAlertDialog(acDoc.Name)
If Not Regex.Match(layMgr.CurrentLayout, name).Success() Then
layMgr.CurrentLayout = name
End If
acTrans.Commit()
Catch ex As Autodesk.AutoCAD.Runtime.Exception
Autodesk.AutoCAD.ApplicationServices.Application.ShowAlertDialog(ex.Message & vbCr & ex.HelpLink & vbCr & ex.StackTrace)
Finally
acTrans.Dispose()
tdoclock.Dispose()
tdoclock = Nothing
End Try
End Using
End Sub
Any help is greatly appreciated.
Matthew