Notifications
Clear all

[Closed] dotNet listbox.add problem in max 2008

How, can I add items to the dotNet listbox in max 2008? In max 2009 its very simple and its goes something like this:

ListItems = #("Item1", "Item2", "Item3", "Item4", "Item15")
dotNetControl lv "System.Windows.Forms.Listbox"
lv.items.addrange listitems

But in max 2008 and max 9 this method doesn’t work. Its says “No method found which matched argument list”
Anyone knows how to add those items to listbox?

2 Replies

in max 9 / 2008 you need to supply a system.string rather than a max string so your code would be

stringArray = #("Item1", "Item2", "Item3", "Item4", "Item15")
 ListItems = for s in stringArray collect dotNetObject "System.String" s
 dotNetControl lv "System.Windows.Forms.Listbox"
 lv.items.addrange listitems

it’s annoying but if your coding for pre-2009 then that’s the way you have to do it

Thanks, for your reply.
I have just found this solution, and I was writing it, but you were faster. Thanks again for answer