Tracking Forums, Newsgroups, Maling Lists
Home Scripts Tutorials Tracker Forums
  HOME    TRACKER    Visual Basic

Changing Font Color In Rich Text Box

Hi, can u tell me how to change the font color in rich text box control..

I want few
line color to in red
and few in blue
and few in black.

how to get this.

thanks in adv.

View Complete Forum Thread with Replies

See Related Forum Messages: Follow the Links Below to View Complete Thread
Changing The Color Of The Font In A Rich Text Box
Is it possible to change the font color of a richtextbox?


Changing The Font Color Of A Rich Textbox

how can I change the font color of a rich textbox? I've tried looking for "forecolor" option but there's none...


Changing The Font Color Of A Rich Textbox

how can I change the font color of a rich textbox? I've tried looking for "forecolor" option but there's none...


Changing The Font Color Of A Rich Textbox

how can I change the font color of a rich textbox? I've tried looking for "forecolor" option but there's none...


Edited by - gen23 on 5/6/2004 10:44:28 PM

Rich Text Box Change Font Color
I have a sub that reads in and changes the selcolor of a rich text box.

The code executes fine and if i run the code and then write in the rich text box the text is the color set by the selcolor but if i click on a button i have set up that simply enters some text into the rich text box the text color stays black (its original color)

what do i need to do to get the text to change to the set color when it is entered like it does when its written in.

Changing Font Properties In Rich Text Box
I am making an application in which the computer will dialog with the user about any problem and the user can answer in "yes" or "no".
I have used rich text box for displaying the conversation. Now i want that whatever questions asked by computer should appear as bold and italic and the answer by user (yes or no) apear in noramal text with a different colour. (like chating software msn or yahoo have different colours for both persons)
How can i change the font proerties at every line. When i used the setfont proerty it change the whole rich text box properties.

Rich Text Box Changing Color
Hi people! I have problems with RichTextBox Control.
My app runs a process and i have a richtextbox control to show information about the process being executed.
I have a

I have this sub "Informar" to write text to the richtextbox control and its parameters are :
Text to print to richtextbox, Forecolor for that specific text i have as a parameter, Fontname, FontSize and FontBold. (I pasted code below)

The problem it doesnt change forecolor nor fontsize ....
why? what am i doing wrong?

Private Sub Informar(ByVal sText As String, _
Optional ByVal cForeColor As OLE_COLOR = vbBlack, _
Optional ByVal sFontName As String = "Tahoma", _
Optional ByVal iFontSize As Integer = 8, _
Optional ByVal bFontBold As Boolean = False)

Dim iStart As Integer, iLen As Integer

With RichTextBox1
.Text = .Text & sText

iLen = Len(sText)
iStart = Len(.Text) - iLen

If iStart > 0 Then
.SelStart = iStart + 1
.SelStart = 0
End If

.SelLength = (iLen + 1)

.SelFontName = sFontName
.SelFontSize = iFontSize
.SelColor = cForeColor
.SelBold = bFontBold
End With
End Sub

Private Sub Command1_Click()
RichTextBox1.Text = vbNullString
Informar "Información...", vbBlack
Informar vbCrLf & " D ", vbGreen, "Wingdings", 30, True
Informar " No se han encontrado tarjetas a procesar!", vbGreen, True
End Sub

Sorry my english and thanks in advanced!

Changing Font/color/bold Of Certain Text..
say i have 2 buttons... each button enters text into a textbox... the same textbox... and it adds it all together so there on top of eachother...

like this

| Button 1 text |
| Button 2 text |

now say i want to change the bold to the button 2 text... and only make that bold.. or change the color... but the button 1 text stays the same... now of course i would set this before i wrote to the textbox.. but any ideas... how i can just change the color to say one line of the textbox instead of the whole textbox...

Changing Font Color Cause Text Box To Flicker
If my rich text box control has more text than can currenlty be dispalyed at one time and I change the font color of all the text in the text box, the rich text box will flicker. If the total text in the rich text box does not fill up the entire rich text box dispaly area, I can change any text font color and I do not get any flicker. Is there any way to prevent this repaint event from occuring?

my code is pretty simple:

Text1.SelStart = 0
Text1.SelLength = Len(Text1.Text)
Text1.SelColor = NormalFontColor

Richtextbox Text Changing Color When Font Size Changes

I have code to change the font size of the text in my Richtextbox, but when it does change the font size, it also changes the color of whatever the text currently is to black. In other words, if the text is currently red or blue, it will change the text to black.

combo1.additem "8"
combo1.additem "9"
combo1.additem "10"
combo1.additem "11"
combo1.additem "12"
combo1.listindex = 0

Private Sub Combo1_Click()
RichTextBox1.SelStart = 0
RichTextBox1.SelLength = Len(RichTextBox1.TextRTF)
RichTextBox1.Font.Size = Combo1.Text
End Sub

Anyone have any ideas why this might be happening ?


A Text Field In A Form Changing Color Of The Font?
Please, how in VBA for MS Access write a code so that a text field in a form changes its font color depending on the field's value?

Thanks a lot in advance!

Changing Font Color Of Command Button Text
How can I change the font color of command button's text?

Changing Color Text Of Rich Text Box
how would i change the color of text ina RICXH TEXT BOX sand format it

Changing Text Color In A Rich Text Box
two fairly easy ones (hopefully!):

I want to change the text color in a rich text box any idea?
For some reason the tab button makes the cursor disapear out of my rich text box, know how to fix this?

Anybody have any ideas?

Changing Textbox Text Font Type/Size, Bold, Italic, Underline And Color
Hi everyone, this is urgent.

I have a textbox where user can type in there. When user select (highlight) the text they can change the font, size, Bold, Italic, Underline and/or color. It should work like in MS Word.

How do I do this? I have a combo box for Fonts, a combo box for Size, and 4 command buttons for B, I, U, and Color.

Please help?


Rich Textbox Font Color
I made a chat window for my chat program that when it loads up, it's
rich textbox color alway reverts back to black.

What the chat form does is when you click on the send button, the
message is sent and then the form is unloaded. I have public variables
in place to hold all the font properties. When the user sends a message
back, the chat form or message box loads back up, displaying the new
message. In the form load event, the font properties are reloaded with
the values already held in the public font variables and everything works
except for the font color.

My problem is that even if i have my font color set to red, when the form
loads back up, the rich textbox font color always goes back to black.

I've heard and experienced myself that the rich textbox has flaws in it.
For instance, if the font color is set to red and i change the font bold
property, the font color goes back to black.

I was just wondering if there is a way to subclass the rich textbox to
get it's font color property instead of the Selcolor property.

I noticed the rich textbox has font.bold, font.italic, font.underline and
font.size properties but not font.color. I wonder why?

Changing Back Color Or Font Color Of DTP
hi folks,
I have a DTP whose value is being populated from Access 2003 database. I require that if the year value is less than 1951 then it should have a backgroundcolor as vbred or atleast the font displayed should change to vbred. I tried the below code line in change & click event of DTP but to no effect. I did not use both codes together or use the codes in both the events simultaneously.

VB Code:
If Year(Me.dtp1.Value) <= 1950 Then Me.dtp1.CalendarForeColor = vbRedIf Year(Me.dtp1.Value) <= 1950 Then Me.dtp1.CalendarBackColor = vbred

could somebody help me.

Detecting The Current Font And Font Size On Various Lines In A Rich Text Box.
I have written an editor that uses a rich text box as the main text area.

The editor allows the user to select a font and font size on the toolbar.

My question is, how does one get the combo box text (for both the font and font size) to display the font or font size for the current line of the current character location?

Meaning, if I were to type in two lines, the first line being Arial 12pt, and the second line being Tahoma 14pt, how would I get the program to display the font and font size in the combo boxes?

I know about SelFont, SelStart and such, but I am not selecting any text. I am merely moving the cursor up or down and need to be able to display the font and font size for where the cursor currently is.

Anyone have any ideas?

I thank you in advance.

Parse &lt;font .... &lt;/font&gt; Tag And View The Progress Into A Rich Text Box (Solved)
Hello, does anyone know how to parse the <font ... > </font> tag from an html file and view the output into a Rich Text Box? Using VB Code and even RTF code if you want.

For example: i have this tag

<font name="Arial" size="3" color="#FF0000>Hello</font>


Detecting Font And Font Size On Various Lines In A Rich Text Box.
I have written a basic editor that uses fonts and such, however when I select a different line (while entering text into the text area of the rich text box), it doesn't display the font or font size for that particular location.

Does anyone have any ideas where I can look to solve this problem?

I thank you in advance for any information you may be able to share with me.

Rich TextBox - Changing Font For A Specific Line Only
Hi! I have a long text on a Rich text box control, and i want to change the font for certain lines only. How can i do this without changing the entire textbox's font?

Thank you very much!

Changing Font Color?
hi, it is possible to change the font color in the compiled .exe?

like this one

Changing Font Color
I have a text box in which many numbers will be printed to. Each number has to be within a certain range. Ex: between 0 and 5. 3 is ok but 6 is no good. Now if a number is outside of this range it will be printed but i want it to be red and stand out from all other numbers. Here is what im using just to print the numbers .

ReportText = ReportText & " " & Format(RRD2!, "####.##")

Changing Font Color?
I am writing data to a file. I want specific lines of data to be a different color. How do I manipulate the color?

Changing Font Color
Is there any way to change the font color on buttons? I need to change it to white...

Changing Font Color
I haven't used VB in a fairly long time. I want to change the color of the text when it is between certain characters(ex. change the color to blue when the text is between '{' and '}', much like a code editor), so if you could help me out, give me tutorials, anything it would be much appreciated. I have a rich text box control.

Changing Text Color In An RTF Without Changing The Current Texts' Color
I need to add multiple lines of text to a Rich Text box, all with differnt colors.

Now if say, i have an line of text colored orange, and i add a line of text colored as red, the orange line becomes black (default) and the last line is red.

I need to keep the orange line orange, while the new line red

i will attach the code of the test example i wrote:

You will need to add the Microsoft Rich Text Box v6

Here is the code i did in the command button (Command1)

With RTB
.Text = .Text & Text1

.SelStart = Len(.Text) - Len(Text1)
.SelLength = Len(Text1)
.SelColor = Val(Text2)

End With

The form contains a rich text box (RTB) a text box where you input the text to be added (Text1) another text box where you enter the color of the new text (Text2) and the command button to add (Command1)

Changing Font Color In A Label

I been trying to change the font color in my label. I know what the color is in Photoshop. The rgb is 37,37,119 and the hex is 252577.

So in my code I have "label1.forcolor = &H00252577" this changes the font color but its not the color I need.

I also tried changing this in the properties for the label but I cant get the color to match the rgb values found in PS.

Any help appreciated.

Changing A Sentence's Font Color
Alright, this is kind of a stupid question, but I don't know how to do it. I have created a multi-user chat program to use in school, and now I am adding extra features. One of the ones I wanted to do was having a user change his or her font color, but everytime I change the font color on the text box ALL the fonts change color. If anyone could help me out with this just let me know.

Also I have been a member here since May but have never posted, and I want to thank you guys for all the helpful stuff I learn just browsing the website. So THANKS YOU GUYS!

Richtextbox Font Color Not Changing
ok, i cant seem to get the color to change for me

RichTextBox1.SelColor = vbBlue

all the other stuff works

RichTextBox1.Font.Italic = True
RichTextBox1.Font.Name = "Comic Sans MS"
RichTextBox1.Font.Size = 20
RichTextBox1.Font.Bold = True
RichTextBox1.Font.Underline = True

but the color isnt firing.

Changing Font Color In Listbox
in a list box how do I specify that the first list font color is red and the second one should be black ?

Thank you

Changing Font Color In Command Box
I don't see fore color as a property for command box, and would like to change my font color. Please help. thanks.

Changing Font Color In Outlook
Folks, i have the following code that works (sends email) but i would like to change the font to red.
Dim objOutlook
Dim objOutlookMsg
Set objOutlook = CreateObject("Outlook.Application")
Set objOutlookMsg = objOutlook.CreateItem(olMailItem)
objOutlookMsg.To = ""
objOutlookMsg.Subject = "Denali-134 # FAILED "
objOutlookMsg.Body = "Denali-134, BUILD_ERROR "

thanks in advance

How To Save Text Fontsize, Font Style And Font Color
When I save the text in a Richtextbox to a Access Database, How to save the font style and Font color with the text (Assume that user can change font style and color when they typing text into the richtextbox).

Then when I load the text from Access Database back to the Richtextbox, it should associate with it's font style and color when I was saved.

How to realize these functions???

Thanks in advance

Changing Font Color In Command Button
Is there a way to change the color of the caption of a command button?

Changing Disable Textbox Font Color

I need help here, is it possible to change a disable textbox font color?.


Changing Enabled = False Textbox Font Color
i am new to visual basic.

i have set a textbox's enabled properties to false.
the text color in the textbox appear to be grayish, although i have tried to change the forecolor to black.

is there anyway i can get back the font appearing in that textbook to be in black color even after i disabled it?

Changing The Font Color Of Selected Items In A Listbox
How can I change the font color of the selected item(s) in a listbox.

Changing Font Color In A Muli-Column LisBox
I have a ListBox with multiple columns. Is it possible to change the forecolor of an item in the first column? What I would like to do is, when a user selects a row and makes a modification to it, the color of the first column item changes.



Changing The Font Color Of The Column Heading When There Are No Records Under It
I wanted to locate the blank columns (but with heading) in the worksheet and I wanted to change the color of the heading.
         ColumnA    ColumnB        ColumnC
   In the above case I wanted to change the font color of the 'ColumnB' and 'ColumnC'
   How can we automate this one.
   Thank You

Changing Color Of The The Highlight Color And Highlighted Text Color
does someone know of a snippet where it shows how to change the color of the hightlight bar/color and the highlighted text,i am doing something in a rtb and i hate when colors are bouncing all over when highlighting it and wanna set two main colors for highlighting but cant seem to find a snippet

How To Apply Custom Font To Text Box Or Label Or Rich Text Box
I am developing an application where i had to set custom font to a text box or a label or a rich text box. Can anyone suggest me the way i can do it.


Changing Font To Italic In Light Gray Color Based On Data (in MS Access Reports)
Here's a Control Source of one of the fields in a report we have:

=IIf(([Reports]![R_PER_CAT]![txtBB])=0 Or [Reports]![R_PER_CAT]![txtEE]=0, _

As you can see it changes result to "n/a" when some data is missing.

I'd like to also make it italic and in a bit of a lighter color.

Any relatively easy way to do it?

Rich Text Boxes (font)
Hi all

I am trying for the life of me to get my RTB to display Bold font, I would also like to change size as well.
But the code gods are not favoring me today

VB Code:
Dim Fonter As StdFont With Fonter  'I know this looks funny now but one I get this.Bold = True  'working there will be moreEnd WithSet rtbInSum.Font = Fonter TempHold = Format(InExtensionTotalInWrite).TotalCharge, "###,##0.00")rtbInSum.Text = rtbInSum.Text & Chr$(32) & Chr$(32) & Chr$(32) & Chr$(32) & Chr$(32) & Chr$(32) & _Trim(InExtensionTotal(InWrite).Extension) & Chr$(9) & Chr$(9) & Chr$(9) & Chr$(9) & Chr$(9) & Chr$(9) & _Chr$(9) & Trim(InExtensionTotal(InWrite).Minutes) & Chr$(9) & Chr$(9) & Chr$(9) & Chr$(9) & Chr$(9) & _Chr$(9) & "$" & Trim(TempHold) & Chr$(13) & Chr$(10)

When I run this it displays................nothing!
anyone have any Ideas?

Rich Text Box Font Size...
How can I change it if I'm using a ShowFont dialog?


Change Font In A Rich Text Box
I am trying to make a font be applied to an rtb. proplem is, when i use the common dialog, it tells i have no fonts installed. I am currently using this:

    On Error Resume Next
    If ActiveForm Is Nothing Then Exit Sub

    With dlgCommonDialog
        .DialogTitle = "Font"
        .CancelError = True
        .Flags = cdlPDReturnDC + cdlPDNoPageNums
        If ActiveForm.rtfText.SelLength = 0 Then
            .Flags = .Flags + cdlPDAllPages
            .Flags = .Flags + cdlPDSelection
        End If
        If Err <> MSComDlg.cdlCancel Then
        End If
    End With

An help would be appreciated


Rich Text Box Font Change.
How do you change the font of rich text box to only selectd text or text not typed yet? thx

Change Of Font In Rich Text Box
I wanted to change the font of the selected text in rich text box, but it changes the font for whole rich text box. Can i change the font for selected text as well as can i underline selected text in rich text box.
I am creating a notepad for my computer class project in which i used rich text box as a editable document. Does any one have other solution.

Thanking in anticipation.

Copyright © 2005-08, All rights reserved