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 strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

command button write to rich text box

Status
Not open for further replies.

daveleo

Programmer
Mar 2, 2002
54
US
hello
i am trying to write the text "<BR>" into a rich text box control when a command button named [cmdLB] is clicked. i intend to mouseclick within the text already in the text box, then click the [cmdLB] button and write "<BR>" at the cursor location.

i am stumbling around my books here and cant think of a way to do that.

any help would be appreciated.

thanks, in advance.

daveleo
 
Ok, I also hate hints so:
If rtb is the name of the fithtextbox...

Code:
rtb.Text = Left(rtb.Text, rtb.SelStart) & "<BR>" & Right(rtb.Text, Len(rtb.Text) - rtb.SelStart)



-bclt
 
.. or even just:
Code:
rtb.SelText = "<BR>"

________________________________________________________________
If you want to get the best response to a question, please check out FAQ222-2244 first
'If we're supposed to work in Hex, why have we only got A fingers?'
Essex Steam UK for steam enthusiasts
 
thanks to both of you....i tried to give stars but the stars didnt work (?)
both methods work, being lazy, i went with johnwm's shorter appraoch, but both are appreciated.

daveleo
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top