.NET

Reply
Active Contributor
MGOMKD
Posts: 33
Registered: ‎06-23-2011
Message 1 of 5 (163 Views)

Instance Forms in several drawings

163 Views, 4 Replies
04-24-2012 01:49 AM

Hi All,

 

I'had just met another matter for my Add-on. I noticed that when I instance a new drawing, while a first one is opened, when I load a new Form, this one keep all first drawing's properties. What could happen? 

 

For example, I would like to add the layer list on a ComboBox.

 

My source:

 

Private Sub LayerBox_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load

        '***************************'
        '* Initialisation LayerBox *'
        '***************************'       
              
        Using acTrans = acCurDb.TransactionManager.StartTransaction()
            acLyrTbl = acTrans.GetObject(acCurDb.LayerTableId, OpenMode.ForRead)
            For Each acObjId As ObjectId In acLyrTbl
                acLyrTblRec = acTrans.GetObject(acObjId, OpenMode.ForRead)
                ComboBox1.Items.Add(acLyrTblRec.Name)
            Next acObjId
        End Using        

    End Sub

 This source works, but if i instance a new form on a new drawing, the first drawing's layer list is kept and the new layer list on the second drawing is ignored!

 

Any ideas?