Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

RichTextBox

Posted on 2014-04-03
2
Medium Priority
?
214 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 41

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 2000 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

Efficient way to get backups off site to Azure

This user guide provides instructions on how to deploy and configure both a StoneFly Scale Out NAS Enterprise Cloud Drive virtual machine and Veeam Cloud Connect in the Microsoft Azure Cloud.

Question has a verified solution.

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

Article by: Martin
Here are a few simple, working, games that you can use as-is or as the basis for your own games. Tic-Tac-Toe This is one of the simplest of all games.   The game allows for a choice of who goes first and keeps track of the number of wins for…
Real-time is more about the business, not the technology. In day-to-day life, to make real-time decisions like buying or investing, business needs the latest information(e.g. Gold Rate/Stock Rate). Unlike traditional days, you need not wait for a fe…
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…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
Suggested Courses

926 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