PC Review


Reply
Thread Tools Rate Thread

How to format a string before appending it into a RichTextBox? Is it possible?

 
 
Juan
Guest
Posts: n/a
 
      8th Apr 2004
I`m inserting strings in a rich text control using the AppendText method, I
would like to change certain parts of the string so, for example, a certain
word appears bold and red when inserted. Is it possible using this control?

Thanks,
Juan.


 
Reply With Quote
 
 
 
 
C# Learner
Guest
Posts: n/a
 
      8th Apr 2004
Juan wrote:

> I`m inserting strings in a rich text control using the AppendText method, I
> would like to change certain parts of the string so, for example, a certain
> word appears bold and red when inserted. Is it possible using this control?


Yes, here's an example:

richTextBox.SelectionStart = richTextBox.TextLength;
richTextBox.SelectionColor = Color.Red;
richTextBox.SelectedText = "Red text." + Environment.NewLine;
richTextBox.SelectionColor = Color.Blue;
richTextBox.SelectedText = "Blue text."
 
Reply With Quote
 
 
 
 
Juan
Guest
Posts: n/a
 
      8th Apr 2004
Thanks C# Learner, got it.

Juan.




"C# Learner" <(E-Mail Removed)> escribió en el mensaje
news:#(E-Mail Removed)...
> Juan wrote:
>
> > I`m inserting strings in a rich text control using the AppendText

method, I
> > would like to change certain parts of the string so, for example, a

certain
> > word appears bold and red when inserted. Is it possible using this

control?
>
> Yes, here's an example:
>
> richTextBox.SelectionStart = richTextBox.TextLength;
> richTextBox.SelectionColor = Color.Red;
> richTextBox.SelectedText = "Red text." + Environment.NewLine;
> richTextBox.SelectionColor = Color.Blue;
> richTextBox.SelectedText = "Blue text."



 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Datatable duplicate rows elimination and before removal appending the column values cool phani Introductions 0 4th May 2009 12:17 PM
Appending Overwriting, instead of appending =?Utf-8?B?QW5uZQ==?= Microsoft Access Queries 2 14th Feb 2007 07:05 PM
comparing table data with last time before updating/appending anil Microsoft Access VBA Modules 3 28th Apr 2006 04:41 AM
Check for identical fields in tables (before appending) =?Utf-8?B?anNjY29ycHM=?= Microsoft Access VBA Modules 1 8th Nov 2005 08:20 AM
Exception in String.Format "Input string was not in a correct format" The Crow Microsoft C# .NET 1 23rd Sep 2005 11:04 AM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 09:46 AM.