Solved

RichTextBox

Posted on 2014-04-03
2
210 Views
Last Modified: 2014-04-07
What formatting characters do I put in a string of text to make the characters bold and increase the font size when it’s put in a RitchTextBox.


Example:

Dim sTemp As String

sTemp = "This is some sample data " & vbCrLf
sTemp = sTemp & "Make this line Bold and Font Size 13" & vbCrLf
sTemp = sTemp & "Return to font size 10 and not bold "

RichTextBox.TextRTF = sTemp
0
Comment
Question by:PhilChapmanJr
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 40

Expert Comment

by:Kyle Abrahams
ID: 39976054
You have to look at the RTF formatting.

The easiest way I've found to do this is create an RTF doc in wordpad.

Put something like bold test on the 1 line
and then look at the formatting form there.

Word has additional things that it can do but not all of them are supported by the .Net rich text box.
0
 
LVL 28

Accepted Solution

by:
Ark earned 500 total points
ID: 39981060
Any reason not using standard rtb way?
Private Sub Command1_Click()
   With RichTextBox1
      .Text = ""
      .SelText = "Normal" & vbCrLf
      
      .SelBold = True
      .SelFontSize = 13
      .SelText = "Bold with font size = 13" & vbCrLf
      
      .SelBold = False
      .SelFontSize = .Font.Size
      .SelText = "Normal again"
   End With
End Sub

Open in new window

0

Featured Post

Online Training Solution

Drastically shorten your training time with WalkMe's advanced online training solution that Guides your trainees to action. Forget about retraining and skyrocket knowledge retention rates.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Since upgrading to Office 2013 or higher installing the Smart Indenter addin will fail. This article will explain how to install it so it will work regardless of the Office version installed.
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…

751 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question