468,505 Members | 1,768 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 468,505 developers. It's quick & easy.

string formatting

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
1 2259
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.

Similar topics

5 posts views Thread by Thomas Philips | last post: by
10 posts views Thread by Oliver S. | last post: by
20 posts views Thread by hagai26 | last post: by
5 posts views Thread by Andrew Connell | last post: by
4 posts views Thread by Dennis Myrén | last post: by
7 posts views Thread by ilona | last post: by
7 posts views Thread by L. Scott M. | last post: by
14 posts views Thread by Scott M. | last post: by
1 post views Thread by schoedl | last post: by
6 posts views Thread by Jack | last post: by
reply views Thread by NPC403 | last post: by
3 posts views Thread by gieforce | last post: by
reply views Thread by fmendoza | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.