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

Rrich Text Box Problem

Status
Not open for further replies.

elziko

Programmer
Nov 7, 2000
486
GB
A little bit of code for a rich text box called 'Console'. I've never needed to use these before so I'm a little confused!

temp = Console.SelStart
For i = Console.SelStart To 0 Step -1
If EndSetFunc(Asc(Mid(Console.Text, i, 1))) Then
Console.SelStart = i
Exit For
End If
Next i
Console.SelLength = temp
MsgBox Console.SelText


what I'm trying to do is select text from the current insertion point back to the last occurence of a certain character. I interate backwards through the text from the insertionpoint and the EndSetFunc function gives a TRUE if the character has been found. Lets say the characeter I'm looking for is a '*' and the current insertion point follows a '&'. When the text between these characters is selected (which works because the xpected string appears in the msgbox) it also gets deleted:

Type in: "*hello&" and the rich text box text becomes "*&" and the msgbox text becomes "hello".

How do I stop it getting deleted?

many thanks

elziko
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top