Solved

RichTextBox

Posted on 2014-04-03
2
203 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
2 Comments
 
LVL 39

Expert Comment

by:Kyle Abrahams
Comment Utility
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 27

Accepted Solution

by:
Ark earned 500 total points
Comment Utility
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

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

Introduction In a recent article (http://www.experts-exchange.com/A_7811-A-Better-Concatenate-Function.html) for the Excel community, I showed an improved version of the Excel Concatenate() function.  While writing that article I realized that no o…
When trying to find the cause of a problem in VBA or VB6 it's often valuable to know what procedures were executed prior to the error. You can use the Call Stack for that but it is often inadequate because it may show procedures you aren't intereste…
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
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…

728 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

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now