-
hi guys,
Okay,
my program consist of a richtextbox, textbox, combo box and command button.
In the combobox I have the system fonts.
The richtextbox(rtfmain.text) is the main window
The text box is where the user types something in and after pressing the command button it shows at rtfmain.text.
When I choose a specific font from the combo box it will change to that style on the rtrmain and the regular textbox.
PROBLEM:
The text in rtfmain.text all changes to that font.
I need it to be that only the recent text entered in changes with the font style. Not the previous text allready in the rtfmain.text.
Code:
rtfMain.SelStart = Len(rtfMain.Text) '// auto scroll
rtfMain.Font = cboFonts.Text
any ideas.
Thanks in advance
-
To change just the font of a selected area of text (or to set the font of the current insertion point), use
Code:
rtfMain.SelFontName = "Courier New"
If you don't use the .Sel... properties, you'll change the entire RTB's settings at once as you already know.
-
hmmmm, I tried using that code and all the previous lines in the richtextbox still changed to the font.
?????
Anything else
-
Works fine for me. Add the following code to a Form with a RichTextBox and CommandButton.
Code:
Private Sub Command1_Click()
RichTextBox1.SetFocus
RichTextBox1.SelFontName = "Courier New"
End Sub
-
ehhhh,
Still not working for me. Here is what keeps happening.
( This is an example of the rtfmain.text )
Username: Yakyack I love vb-world.net
Username2: Yes I agree Vb world is the best source of vb
Username: Well good luck programming.
( Now both of the users are you using the font arial. When the user clicks the font they wish to use in the cbofonts, that works fine. The problem that i am experiencing is that when they click the font of their choice and enter it in, all the lines before it ( such as the 3 lines before you which are in all arial) will turn into that font as well. I am only looking for a line to be a different font and the rest of the richtextbox to stay as it was.
Sorry if this is not to clear.
???? Anything Im doing wrong?
Thanks again in advance :)