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
Loading

Abhimanyu K VatsaPosted Jun 14, 2011, 7:45 AM
Suthish NairPosted Jun 14, 2011, 7:30 AM
Posted Jun 14, 2011, 7:15 AM
ds.Tables[0].Rows[comboBox1.SelectedIndex][i].ToString() to get the value. Please check that once.