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!

RichTextBox Formatting as text is added

Status
Not open for further replies.

mpemberton

Programmer
Mar 5, 2002
37
0
0
US
I'm having a tough time adding formatting codes as I add text to the richtextbox. This is a simplified document conversion program where I'm reading in a document that has text that is marked as bold. I read in character by character adding to the richtextbox with rtb.text += newtext. Once I get finished with a section of text that needs to be bold, I select the text, change the selectedfont, then continue on adding text to the box. Unfortunately, the result is the complete box ends up in bold. I know it has to be something simple, so any help would be GREAT!

Here's some basic code I'm doing:

While read external file one character at a time
write character (.text += character)
if character is start of bold area
set temp var as .textlength (for starting point)
end if
if character is end of bold
.select(starting point,length)
.selectionfont = new font(current font info + bold)
end if
end while

I hope that makes sense, couldn't cut/paste the whole program. I've only seen programs where it is interactive changing. This is on the fly editing.

Mark
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top