3
Reply

Error : indexoutofrange Exception

Venkat S

Venkat S

13 years ago
1.3k
i get error below code only str2 += strListItems[i] + ":" + ds.Tables[0].Rows[comboBox1.SelectedIndex][i].ToString() + "\r\n";  the error is indexoutofrange Exception. and my full code is string str2 = "";             string[] strListItems = { ds.Tables[0].Columns[1].ToString(), ds.Tables[0].Columns[0].ToString(), ds.Tables[0].Columns[2].ToString() };             for (int i = 0; i < ds.Tables[0].Rows.Count -1; i++)             {                 str2 += strListItems[i] + ":" + ds.Tables[0].Rows[comboBox1.SelectedIndex][i].ToString() + "\r\n";             }             textBox1.Text = str2;  Please give me any idea to  resolve it 


Thanks
VenkatS

Answers (3)