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

string formatting

P: n/a
Hi,

While iterating through a loop and building a string is it possible to
format certain string value? the completed string eventually gets passed to
a rich TextBox.

for example:

------------------
string thing = "";
foreach (Dataset.Row row in rows)
{
if ( row.name == "whatever" )
{
thing += row.name; //somehow format the
row.name to bold before it goes into the string
}
thing += row.name;
}
-----------------

Possible?
Nov 16 '05 #1
Share this Question
Share on Google+
1 Reply


P: n/a
Grant <gp*****@hotmail.com> wrote:
While iterating through a loop and building a string is it possible to
format certain string value? the completed string eventually gets passed to
a rich TextBox.

for example:

------------------
string thing = "";
foreach (Dataset.Row row in rows)
{
if ( row.name == "whatever" )
{
thing += row.name; //somehow format the
row.name to bold before it goes into the string
}
thing += row.name;
}
-----------------


The string itself isn't bold or anything similar - you need to work out
how to make it bold in the RichTextBox, i.e. applying rich text
formatting.

I would also suggest using a StringBuilder rather than string
concatenation like the above.

--
Jon Skeet - <sk***@pobox.com>
http://www.pobox.com/~skeet
If replying to the group, please do not mail me too
Nov 16 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.