Link to home
Start Free TrialLog in
Avatar of orekin
orekinFlag for Australia

asked on

ListBox Items collection to String Array in VB.NET 1.1

Hi

Here is a helper function I have that I use to return the elements of a list box as a string array.  Is there a better way ?

Orekin

        Public Shared Function ReturnListBoxItemsAtStringArray(ByVal theListBox As Windows.Forms.ListBox) As String()
            Dim strArr As String()
            ReDim strArr(theListBox.Items.Count - 1)
            theListBox.Items.CopyTo(strArr, 0)
            ReturnListBoxItemsAtStringArray = strArr
        End Function
ASKER CERTIFIED SOLUTION
Avatar of Bob Learned
Bob Learned
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial