المساعد الشخصي الرقمي

مشاهدة النسخة كاملة : Extract values in between [] for array



C# Programming
11-08-2010, 02:50 AM
hello i have an array with 100 entries.
currently i would want to extract the values between [] and assign it to a listbox for all the 100 entries.
i tried using the code as shown below however it don't seems to be working. Needing help!


string[] array = new string[listBox2.Items.Count];

for (int i = 0; i < listBox2.Items.Count; i++)
{
string input = array.ToString();
int start = input.IndexOf("[");
int stop = input.IndexOf("]");
string output = input.Substring(start + 1, stop - start - 1);
listBox3.Items.Add(output);

}