checking for last row

  • Thread starter Thread starter maflatoun
  • Start date Start date
M

maflatoun

Hi everyone,

I like add \r\n to all my rows except for the last row. How do I check
for the last in the following code?

StringBuilder sb = new StringBuilder();
foreach (DataRow row in rows)
{
sb.Append(row["Mesg"].ToString());

if (??????????????????) {
sb.Append("\r\n");
}

}

Thanks
Maz.
 
Hi everyone,

I like add \r\n to all my rows except for the last row. How do I check
for the last in the following code?

int i = 0;

foreach...

if(++i==rows.Count) continue;


StringBuilder sb = new StringBuilder();
foreach (DataRow row in rows)
{
sb.Append(row["Mesg"].ToString());

if (??????????????????) {
sb.Append("\r\n");
}

}

Thanks
Maz.
 
Back
Top