Still problems with RTB

vepezu
09-05-2003, 10:10 AM
I'm still working with my html- editor and I have a new problem:

When the user chooses from the menu Add and for example image then it should print: <img src=""> middle to the RTB. I mean in the RTB there is allready some text and the program should add that middle of the other text.

It's hard to explain but try to understand, basic thing is: how to add text to the middle of RTB?

SnakeChomp
09-05-2003, 10:42 AM
RichTextBox1.SelText = "<img src="""">" This will add the text <img src=""> where ever the carrot is located within the rich text box

Squishy
09-05-2003, 10:10 PM
You can add some "intelligence" to your editor by first checking if text is already selected. If it is, insert the selected text between the quotes (as the image source).

E.g.

If RichTextBox1.SelText = "" Then
RichTextBox1.SelText = "<img src="""">"
RichTextBox1.SetFocus
RichTextBox1.SelStart = RichTextBox1.SelStart - 2 'let the user start typing right away
Else
RichTextBox1.SelText = "<img src=""" & RichTextBox1.SelText & """>"
RichTextBox1.SetFocus
End If

vepezu
09-06-2003, 10:09 AM
Thank's a lot!!

EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum