Hi Everyone,
I was hoping someone could help me. I need to take all the items I have in a list box and input them into an array. I have the array set up but I don't know how to put each item in the array. I already have....
int itemsCount = itemsListBox.Items.Count;
string[] items = new string[itemsCount];
But I am stuck here.
Any info will be greatly appreciated.
Thanks in advance!
Jay
Ryan AlfordPosted Jan 16, 2009, 4:29 PM
string[] array = new string[listBox1.Items.Count];
for (int i = 0; i < listBox1.Items.Count; i++)
{
object s = listBox1.Items[i];
array[i] = s.ToString();
}
Guest UserPosted Jan 16, 2009, 12:07 PM
for (int i = 0; i < itemsCount; i++)
items[i] = itemsListBox.Items[i].ToString();
Guest UserPosted Jan 16, 2009, 12:05 PM
int itemsCount = itemsListBox.Items.Count;string[] items = new string[itemsCount];