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
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