[Closed] Access Multiple selections in a dot net listbox?
The msdn says selectedobjectcollection method will give the list of selected items, but when I apply it, I get an error message…for eg: dnListBox.selectedobjectcollection[2] throws an error and all variations What am I doing wrong?
-
The Listbox does not have a property called SelectedObjectCollection. It has a property called SelectedItems which is of type SelectedObjectCollection.
-
A Dotnet collection is not a maxscript array. You can not access it directly by index. You need to use the .item property:
dnListBox.selectedItems.item[0]
You can also try using “showproperties dnListBox”, “showmethods dnListBox” and “showevents dnListBox”. It will print in the MAXscript listener all the available properties, methods and events for the control. It also reports what class it expects from you.