i want to dispaly data in textbox like
id:111
name:venkat
color:green
so befor i display only for data like
111
venkat
green
.................
now i want to display like this
id:111
name:venkat
color:greenhere is my code
string str2 = "";
string[] strListItems;
int intNumItems = comboBox1.Items.Count;
strListItems = new string[intNumItems];
for (int i = 0; i < comboBox1.Items.Count; i++)
{
strListItems[i] = ds.Tables[0].Rows[comboBox1.SelectedIndex][i].ToString();
str2 = str2 + "\r\n " +strListItems[i];
}
textBox1.Text = str2;Please give me any idea.
Thanks
Venkat.S

VulpesPosted Jun 14, 2011, 7:00 AM
Suthish NairPosted Jun 14, 2011, 6:59 AM
Venkat SPosted Jun 14, 2011, 6:35 AM
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 resolve my problem.
Suthish NairPosted Jun 14, 2011, 6:24 AM
Venkat SPosted Jun 14, 2011, 6:19 AM
thanks for replay
befor also i have this error.
when i give max 3 records it ll be ok.run succ
when i give 25 records then get error like indexoutofrange.
what is problem, u have any idea .
i read xml file and when i chek records its read xml file.
ya they can be read from the XML file along with the data.
Please share u r ideas to resolve it.
Thanks
VenkatS
VulpesPosted Jun 14, 2011, 6:11 AM
From what you say, it sounds like it should have 25 elements but I've no idea whether they can be read from the XML file along with the data or whether they have to be added 'manually'.
Venkat SPosted Jun 14, 2011, 5:48 AM
now i have some errors
error:indexoutofrange
how to resolve it.my records are in xml file
i have 25 records
VulpesPosted Jun 14, 2011, 5:38 AM