String foreach problem
- From: ApeX <mmojas@xxxxxxxxx>
- Date: Mon, 09 Jul 2007 15:48:49 -0700
Hi guys, i hace a question
i have a datagrid
col1 col2
-----------------
D text0
text1
text2
D text3
D text4
i need to do a foreach and everywhere where's a "D" in col1 to add the
value of col2 into a string, so the final string would be "text0" +
"," + "text3" + "," + "text4";
for example:
string Uvjet()
{
foreach (DataRow red in dt.Rows)
{
if (red["col1"].ToString() == "D")
{
string uvjet = red["col2"].ToString() + ",";
}
}
return uvjet;
}
...only this fills the string "uvjet" only with one value....and i want
it to be finally filled with all necessary values, like:
"text0" + "," + "text3" + "," + "text4"
if you have any ideas, please help...
THANX!
.
- Follow-Ups:
- Re: String foreach problem
- From: Peter Duniho
- Re: String foreach problem
- From: Göran Andersson
- Re: String foreach problem
- From: Mythran
- Re: String foreach problem
- Prev by Date: Re: multithreaded tcp/ip monitoring application
- Next by Date: Directory.GetFiles() Problem
- Previous by thread: Re: multithreaded tcp/ip monitoring application
- Next by thread: Re: String foreach problem
- Index(es):
Relevant Pages
|