3
Reply

Geting error: index was outside the bounds of the array

Anish Khan

Anish Khan

Feb 10 2010 1:39 AM
5.8k

Hi All,
this is my code to store multiple selected item from a list box in windows application and I am geting error.
Already i have declared array size.
string[] ItemArray = new string[20];
for (int i = 0; i <= listBox1.SelectedItems.Count; i++)
{
txtmessage.Text = ((DataRowView)listBox1.SelectedItem).Row.ItemArray[i].ToString();
}
Please help me
Thanks

Answers (3)