954,551 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

Changing color of selected text in a RichTextBox?

Hello all,

I'm taking my first BASIC programming class this year, and for a final project, I'm trying to make a book-keeping log.

What I want to have happen, is to open a list of books, highlight a book title, click the "check in" button and have the text change to green, or red if the "check out" button is clicked, but I'm having problems trying to change the color of the text.

If anyone could explain how to do so, it would be greatly appreciated.
Thanks in advance!

Suirbachi
Newbie Poster
1 post since Jan 2012
Reputation Points: 10
Solved Threads: 0
 

Use the SelColor method.
Example code:

Private Sub cmdCheckIn_Click()
Me.RichTextBox1.SelColor = vbRed
End Sub

A further explanation (and example) is in the VB help file. Wonderful thing, that help file. You should browse it some time just for some interesting insights.

BitBlt
Master Poster
711 posts since Feb 2011
Reputation Points: 367
Solved Threads: 109
 

This article has been dead for over three months

Post: Markdown Syntax: Formatting Help
You
View similar articles that have also been tagged: