-
Code:
text1.fontbold
text1.fontitalic
text1.fontunderline
No problems, the above I can do to make all the text in a box bold, italic, underline etc.
If I wanted just the selected highlighted text to be bold if I click a commandbutton, I think I have to use the seltext option, so I have been trying :
Code:
text1.seltext.fontbold
which does not work, all I have left to put here then is HHHHEEEEELLLLPPPPPP!!!!!! (please, alright then, pretty please). :D
-
Probably because I dont think a textbox can be used that way. You can have one setting for one textbox. That is one font, one color, etc...
RichText-control on the other hand has what you need.
-
As Thomas Halsvik said, use a RichTextBox. Here is a code can use for it as well:
Code:
Private Sub Command1_Click()
If RichTextBox1.SelText <> "" Then
RichTextBox1.SelBold = Not RichTextBox1.SelBold
End If
End Sub
This will highlight whatever item is selected. If it's highlighted again while it's bold, when you click the command button, it will make the text not bold anymore.
-
<?>
As stated it won't work on seltext but on a text box
it is not as you stated, you must give it a value.
Correct Way.
Text1.FontBold = True
Text1.FontItalic = True
Text1.FontUnderline = True
-
Thank you, spotted that one though (I was writing from memory - which I have little sane amounts of).
Will use the rich text box then, thankx everyone!