Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Making a word in a string bold

Status
Not open for further replies.

theogary

Programmer
Mar 3, 2003
99
0
0
US
How can you make one word in a string bold.
 
I know that
I should have been more clear.

st_1.text = "This is what I want"+ <Bold> + "this text" + <Bold>

I want the phrase "this text" to be bold.
 
In a RichTextEdit object you use the SetTextStyle function to set the currently selected text to bold, underlined, italics, etc. The trick is to select the text you want to change. The SelectText function in a RichTextEdit object requires a starting line, starting character, ending line, and ending character. If you have not already done so, you will need to write a routine to determine at what line and character the text you want to change currently starts and ends so you can select it before calling the SetTextStyle function.
 
Using a rich text edit control just to display part of a line of static text as bold seems a bit excessive. I don't know of any way to accomplish this with a single static text control since static text controls are pretty "dumb".

One option would be to use multiple static text controls with the Bold property of the appropriate control set to True.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top