Message 1 of 8
Switching layouts & Windows form doesn't work

Not applicable
11-15-2007
03:11 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
I am working with a plotting macro and my WindowsForm needs to activate a layout...Here is the problem. It doesn't work.
The method I am using to switch the layout is:
LayoutManager.Current.CurrentLayout() = "Layout1"
I know this works since if I have it like below without loading form it works fine:
Public Sub TestLayout()
LayoutManager.Current.CurrentLayout() = "Layout1"
End Sub
The one line of code will also work if its place inside the Form_Load event of the form i'm using...But once I place the code in any Button_Clicked event it doesn't work anymore. The drawing stays in Model space and a prompt says it regening layout...The code you can try is below:
Public Sub TestLayout()
Dim frm As New Form1
frm.Show()
End Sub
Imports Autodesk.AutoCAD.DatabaseServices
Public Class Form1
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
LayoutManager.Current.CurrentLayout() = "Layout1"
End Sub
End Class
The method I am using to switch the layout is:
LayoutManager.Current.CurrentLayout() = "Layout1"
I know this works since if I have it like below without loading form it works fine:
Public Sub TestLayout()
LayoutManager.Current.CurrentLayout() = "Layout1"
End Sub
The one line of code will also work if its place inside the Form_Load event of the form i'm using...But once I place the code in any Button_Clicked event it doesn't work anymore. The drawing stays in Model space and a prompt says it regening layout...The code you can try is below:
Public Sub TestLayout()
Dim frm As New Form1
frm.Show()
End Sub
Imports Autodesk.AutoCAD.DatabaseServices
Public Class Form1
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
LayoutManager.Current.CurrentLayout() = "Layout1"
End Sub
End Class