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
Code
id:111
name:venkat
color:greenhere is my code
C#
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


VulpesRank #55 · 29.2K reputationPosted Jun 14, 2011, 3:00 AM EDT
VulpesRank #55 · 29.2K reputationPosted Jun 14, 2011, 1:38 AM EDT
Venkat S187 reputationPosted Jun 14, 2011, 1:48 AM EDT
now i have some errors
error:indexoutofrange
how to resolve it.my records are in xml file
i have 25 records
VulpesRank #55 · 29.2K reputationPosted Jun 14, 2011, 2:11 AM EDT
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 S187 reputationPosted Jun 14, 2011, 2:19 AM EDT
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
Suthish NairRank #92 · 22.8K reputationPosted Jun 14, 2011, 2:24 AM EDT
Venkat S187 reputationPosted Jun 14, 2011, 2:35 AM EDT
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 NairRank #92 · 22.8K reputationPosted Jun 14, 2011, 2:59 AM EDT