473,320 Members | 2,006 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

formatting in a richtextbox

hi,

i have a richtextbox in my app. when a button is disabled, the richtextbox
control should say "The button is now disabled". only the word disabled
should be emboldened. how do i make only the word bold?

my code so far is

if (Button1.Enabled = false)
{
richTextBox1.Text = "The button is now disabled";
}

--
Alvo von Cossel I of Germany
Nov 17 '05 #1
2 1733
You can either use a combination of SelectedText and SelectionFont e.g.
richTextBox1.SelectedText="The button is now ";
richTextBox1.SelectionFont=New
Font(currentFont.FontFamily,currentFont.Size,FontS tyle.Bold);
richTextBox1.SelectedText="disabled";

or else pipe in the RTF characters directly e.g.
richTextBox1.Rtf = @"{\rtf1\ansi The button is now \b disabled\b0.}";

Cathal
"Alvo von Cossel I" <Al************@discussions.microsoft.com> wrote in
message news:61**********************************@microsof t.com...
hi,

i have a richtextbox in my app. when a button is disabled, the richtextbox
control should say "The button is now disabled". only the word disabled
should be emboldened. how do i make only the word bold?

my code so far is

if (Button1.Enabled = false)
{
richTextBox1.Text = "The button is now disabled";
}

--
Alvo von Cossel I of Germany

Nov 17 '05 #2
hi,

thanks. you answered my question!
--
Alvo von Cossel I of Germany
"Cathal Connolly [C# MVP]" wrote:
You can either use a combination of SelectedText and SelectionFont e.g.
richTextBox1.SelectedText="The button is now ";
richTextBox1.SelectionFont=New
Font(currentFont.FontFamily,currentFont.Size,FontS tyle.Bold);
richTextBox1.SelectedText="disabled";

or else pipe in the RTF characters directly e.g.
richTextBox1.Rtf = @"{\rtf1\ansi The button is now \b disabled\b0.}";

Cathal
"Alvo von Cossel I" <Al************@discussions.microsoft.com> wrote in
message news:61**********************************@microsof t.com...
hi,

i have a richtextbox in my app. when a button is disabled, the richtextbox
control should say "The button is now disabled". only the word disabled
should be emboldened. how do i make only the word bold?

my code so far is

if (Button1.Enabled = false)
{
richTextBox1.Text = "The button is now disabled";
}

--
Alvo von Cossel I of Germany


Nov 17 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Neil | last post by:
Is there an editable RTF textbox control which allows the user to apply bold, italic, etc.? I tried the Microsoft Rich Textbox Control, but there doesn't seem to be a way to allow the user to...
0
by: Hariharan S | last post by:
Hi Guys, I have a string, say "Hello World" and would like to format the way I want to (say, wanna have the Hello to be bold italic and the World to be of font size 14 or so) and put it in the...
2
by: Hariharan S | last post by:
Hi Guys, I have a string, say "Hello World" and would like to format the way I want to (say, wanna have the Hello to be bold italic and the World to be of font size 14 or so) and put it in the...
0
by: Radu.Micu | last post by:
I have a RichTextBox on my form and I want to save the text that a user writes into it in a AccessDB but I want to save the formatted text not only plain txt I have seen in some programs that the...
0
by: Barguast | last post by:
I've just started messing around with the new .NET 2.0 RichTextBox control and I've got a question. How would I, for example, underline the selected block of text bearing in mind that the selection...
1
by: Kevin | last post by:
Hello, Does anyone know how to implement find and replace in a RichTextBox in a way that does not lose the text formatting? As a first attempt I tried rtb.Rtf.Replace(sFindText,...
2
by: Chris Rollock | last post by:
on msdn: "you can initialize the Rtf property to a string that contains the text to display, including the RTF codes that determine how the text should be formatted." Nowhere can I find an example...
0
by: ronchese | last post by:
Hello All. I'm using the RichTextBox control to show text to user that can do the primary font formatting: fontname, size, color, bold, italic and underline. Unlike the RichTextBox used in VB...
3
by: michael sorens | last post by:
The documentation for the RichTextBox is sketchy at best. I want to do a very simple task but I cannot find information on this. I am using a RichTextBox as an output window. Some text I want to...
2
by: drfreaky | last post by:
Hello, I want to use a richtextbox for logging status messages. I have three kind of message types and want to use different formatting for them. My problem is, I change the color, add the text...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
0
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.