Message 1 of 17

Not applicable
01-28-2015
11:35 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Selection of objects to edit either attributes or text is going great for me until I get to MLeaders. Our keynotes are set up as an MLStyle with a block. Within the block is an attribute. I can get to the BlockTableRecord of that block but as yet am unable to get to the BlockReference of the block to access the attributes for edit. Appropriate research has been completed. Now I call on the forum. Any help to get me to the BlockReference?
Code below starts with the selection (perid) sorted by name.
'MLeader ElseIf pername = "MULTILEADER" Then Using tr As Transaction = db.TransactionManager.StartTransaction Dim mld As MLeader = tr.GetObject(perid, OpenMode.ForRead, False, True) Dim btr As BlockTableRecord = TryCast(tr.GetObject(mld.BlockContentId, OpenMode.ForRead), BlockTableRecord) Dim br As BlockReference = CType(tr.GetObject(btr, OpenMode.ForRead), BlockReference) '<~~~~ISSUE HERE If btr.HasAttributeDefinitions Then Dim blkname As String = btr.Name Dim z As Integer = 0 For Each attid As ObjectId In btr Dim attdef As AttributeDefinition = TryCast(tr.GetObject(attid, OpenMode.ForRead), AttributeDefinition) Dim AttRef As AttributeReference = CType(tr.GetObject(br.AttributeCollection(z), OpenMode.ForRead), AttributeReference) taglist.Add(attdef.Tag) promptlist.Add(attdef.Prompt) Dim prmt As String = promptlist(z) tbname = "textbox" & z pretxt = AttRef.TextString lb = New System.Windows.Forms.Label With lb .Size = New System.Drawing.Size(100, 40) .Location = New System.Drawing.Point(10, z * 45 + 10) .Text = prmt End With tb = New System.Windows.Forms.TextBox With tb .Name = "tb" & z .Size = New System.Drawing.Size(500, 20) .Location = New System.Drawing.Point(120, z * 45 + 10) .Text = pretxt .TabIndex = z .AcceptsTab = True .Enabled = True .SelectAll() End With With Me .Text = blkname .Panel1.Controls.Add(lb) .Panel1.Controls.Add(tb) .Panel1.AutoScroll = True .Panel1.Enabled = True .AutoSize = True .Update() End With z = z + 1 Next Else End If tr.Commit() End Using End If
Appreciative accolades promised for any assistance
Solved! Go to Solution.