• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1270
  • Last Modified:

How to Make Specific Text in a String Bold in Visual Studio C# 2008 Using a RichTextBox

I am attempting to write a RichTextBox and I need to be able to write part of a sentence in bold and the remainder of the text in the sentence in regular type. Could someone help me figure out what the syntax would be in order to complete this task? For instance, if the control was called RichTextBox1 and the sentence was "The dog crossed the road", how would I get the word "dog" to be bold and the remainder of the sentence to be regular type?

Any help that could be provided on this topic would be greatly appreciated.
0
thenthorn1010
Asked:
thenthorn1010
  • 2
  • 2
1 Solution
 
Mike TomlinsonMiddle School Assistant TeacherCommented:
0
 
käµfm³d 👽Commented:
Using the code I posted in your other question, change line 6 to:

richTextBox1.SelectionFont = new Font(richTextBox1.SelectionFont, FontStyle.Bold);

Open in new window

0
 
käµfm³d 👽Commented:
@Idle_Mind
The question is slightly different.
0
 
Mike TomlinsonMiddle School Assistant TeacherCommented:
Ah...I see.
0

Featured Post

NEW Veeam Agent for Microsoft Windows

Backup and recover physical and cloud-based servers and workstations, as well as endpoint devices that belong to remote users. Avoid downtime and data loss quickly and easily for Windows-based physical or public cloud-based workloads!

  • 2
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now