How to display listbox items in array format in C#


#1

this is my list box which contain values and i want that values to be in
int array
like
int array[] = new int[...];
and printing in text box (multiline)

  textBox2.Clear();
            int[] k1 = new int[listBox1.Items.Count];

            for (int i = 0; i < listBox1.Items.Count; i++)
            {
                k1[i] = (int)listBox1.Items[i];
                textBox2.Text = k1[i].ToString();

            }

not working i implemented it pls help anyone


#2

Hi

How is the data being added to the listbox? What format is it in? I cannot really figure out what is going on without that step

Thanks