views:

1260

answers:

1

I'm programming an application in VB.NET in which I need to take the Items from a ListBox, which are an ListBox.ObjectCollection and convert into a String array to be passed as a parameter to a Sub procedure. How should I do it?

+1  A: 

Assuming .NET 3.5, and thus LINQ:

(From item As Object In yourListBox.ObjectCollection Select item.ToString()).ToArray()

This also assumes that the way you want to convert items to strings is via ToString() - but, of course, you can replace it with anything else

Pavel Minaev