Solved

RichTextBox

Posted on 2014-04-03
2
212 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

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!

Question has a verified solution.

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

Have you ever wanted to restrict the users input in a textbox to numbers, and while doing that make sure that they can't 'cheat' by pasting in non-numeric text? Of course you can do that with code you write yourself but it's tedious and error-prone …
Most everyone who has done any programming in VB6 knows that you can do something in code like Debug.Print MyVar and that when the program runs from the IDE, the value of MyVar will be displayed in the Immediate Window. Less well known is Debug.Asse…
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…
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…
Suggested Courses
Course of the Month9 days, 19 hours left to enroll

624 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