I have been looking for the specified code all day long, browsing through the MSDN libraries from microsoft, but I wasn't able to find or come up with a solution:
Question: How can I add a string to an existing array?
I have been trying this
Dim Items() As String
Items = ListBox1.Items.Cast(Of String).ToArray
Array.Reverse(Items)
Me.ListBox1.Items.Clear()
Me.ListBox1.DataSource = Items
**Items.add("Add This to my array")**
But this doesn't work unfortunately.
My code is loading a populated listbox into an array (reverses the entries, and then cleans the listbox before populating it with the array).
How can I add to this array now?
List(Of String)you could do that.Dim Items() As String = ListBox1.Items.Cast(Of String).ToArrayHow would it has to look to define Items() as a List?Redim preserve Items(Items.Count) 'Adds a new element to end of array. Items(Items.Count-1) = "Add this to my array"BindingList<T>would be a better choice.