B
Bill Gower
Why can't an ArrayList be passed to the ListBox.AddRange method?
Bill
Bill
Bill Gower said:When I try the first one I get an error that say that it expects a type so
I put string[] as the parameter to typeof() and then I get an error
stating the AddRange method has some invalid arguments and it can't
convert from System.Array to
System.Windows.Forms.ListBox.ObjectCollection.
Bill
ClayB said:An ArrayList is not a 1 dimensional Array object (or
ListBoxObjectCOllection) which is what ListBox.AddRange accepts. You
can however pass ArrayList.ToArray.
listBox1.AddRange(arrayList1.ToArray(typeof());
or
listBox1.AddRange(arrayList1.ToArray(typeof(MyObject));
======================
Clay Burch
Syncfusion, Inc.