ListBox Help

ListBox Help

Anonymous
Not applicable
218 Views
2 Replies
Message 1 of 3

ListBox Help

Anonymous
Not applicable
Hello everyone,
I'm having troubles creating a list box. What i'm doing is listing all entities with xdata from the app "AssoxText" and adding them to a list. I would like the listbox to have two columns. Both columns will have info taken from the xdata that I've filtered for. I've used this code to get all the objects with "AssocText" xdata.

Dim ssetObj As AcadSelectionSet
Dim mode As Integer
Dim gpCode(1) As Integer
Dim dataValue(1) As Variant
Dim groupCode As Variant
Dim dataCode As Variant
Dim xdataOut As Variant
Dim xtypeOut As Variant
Dim appName As String

Set ssetObj = ThisDrawing.SelectionSets.Add("SSET")
mode = acSelectionSetAll
gpCode(0) = 0
dataValue(0) = "Mtext"
gpCode(1) = 1001
appName = "AssocText"
dataValue(1) = appName
groupCode = gpCode
dataCode = dataValue

ssetObj.Select mode, , , groupCode, dataCode

Then I iterate through all the objects in the selection set and add them into the list box with this code.

For Each Entry In ssetObj
Entry.GetXData appName, xtypeOut, xdataOut
XdataList1.AddItem xdataOut(1)
Next ent

This code works fine. But i'd also like to add xdataOut(2) to the list in the second column. I'm having trouble finding any examples or info in the on-line docs to point me the right way. At the moment I just created a second listbox and did it this way:

For Each Entry In ssetObj
Entry.GetXData appName, xtypeOut, xdataOut
XdataList1.AddItem xdataOut(1)
XdataList2.AddItem xdataOut(2)
Next ent

Can someone give me some pointers or info on how to add this info into the second column. Thanks for your help.

Cheers,
Matthew Corbin
0 Likes
219 Views
2 Replies
Replies (2)
Message 2 of 3

Anonymous
Not applicable
Try this in your For Each Entry loop: XdataList1.AddItem xdataout(1) ' creates the next row XdataList1.Column(1, (XdataList1.ListCount - 1)) = xdataout(2) ' adds data to second column of the last row created. HTH, Jeff "Matthew.Corbin" wrote in message news:1834545.1080156481174.JavaMail.jive@jiveforum1.autodesk.com... > Hello everyone, > I'm having troubles creating a list box. What i'm doing is listing all entities with xdata from the app "AssoxText" and adding them to a list. I would like the listbox to have two columns. Both columns will have info taken from the xdata that I've filtered for. I've used this code to get all the objects with "AssocText" xdata. > > Dim ssetObj As AcadSelectionSet > Dim mode As Integer > Dim gpCode(1) As Integer > Dim dataValue(1) As Variant > Dim groupCode As Variant > Dim dataCode As Variant > Dim xdataOut As Variant > Dim xtypeOut As Variant > Dim appName As String > > Set ssetObj = ThisDrawing.SelectionSets.Add("SSET") > mode = acSelectionSetAll > gpCode(0) = 0 > dataValue(0) = "Mtext" > gpCode(1) = 1001 > appName = "AssocText" > dataValue(1) = appName > groupCode = gpCode > dataCode = dataValue > > ssetObj.Select mode, , , groupCode, dataCode > > Then I iterate through all the objects in the selection set and add them into the list box with this code. > > For Each Entry In ssetObj > Entry.GetXData appName, xtypeOut, xdataOut > XdataList1.AddItem xdataOut(1) > Next ent > > This code works fine. But i'd also like to add xdataOut(2) to the list in the second column. I'm having trouble finding any examples or info in the on-line docs to point me the right way. At the moment I just created a second listbox and did it this way: > > For Each Entry In ssetObj > Entry.GetXData appName, xtypeOut, xdataOut > XdataList1.AddItem xdataOut(1) > XdataList2.AddItem xdataOut(2) > Next ent > > Can someone give me some pointers or info on how to add this info into the second column. Thanks for your help. > > Cheers, > Matthew Corbin
0 Likes
Message 3 of 3

Anonymous
Not applicable
Jeff,

That worked brilliantly! Thanks for your help.

Matthew Corbin
0 Likes