By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
458,087 Members | 989 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 458,087 IT Pros & Developers. It's quick & easy.

checking for last row

P: n/a
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.

Mar 27 '06 #1
Share this Question
Share on Google+
1 Reply


P: n/a
ma*******@gmail.com wrote:
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.

--
Get the new
http://www.you-read-it-here-first.com
content from Texeme Textcasting Technology
Mar 27 '06 #2

This discussion thread is closed

Replies have been disabled for this discussion.