|
-
Mar 24th, 2003, 05:29 PM
#1
RichTextBox .SelBold is driving me nuts * RESOLVED
I'm using this code which I got here at VBForums:
VB Code:
Private Sub txtSession_Change()
Dim nPos As Long
nPos = -1
Do
nPos = txtSession.Find((Trim(txtSendTo.Text) & ":"), nPos + 1, Len(txtSession.Text))
If nPos <> -1 Then
txtSession.SelColor = vbBlack
txtSession.SelBold = True
End If
Loop While nPos <> -1
'txtSession.SelStart = 0
'txtSession.SelLength = 0
txtSession.SelBold = False
End Sub
First time it runs, its ok. But on succeeding calls it sets all text to bold instead of just the result from .Find. Actually, even before the procedure starts statements on the 2nd and succeeding calls(I put a break on Private Sub txtSession_Change()), all the text is already changed to bold.
I inserted txtSession.SelBold = False in hopes of preventing this but it had no effect. I even tried the statements above that are commented out. This is the only procedure in the project wherein .SelBold is used so the prob can't be anywhere else. I checked .SelLength, .SelStart, and .SelText right after executing .Find and their values are ok, but the text still turns to bold. I checked the value of .SelBold in several other procedures (before and after the call to this procedure) and its value is false as expected. I CAN'T FIGURE OUT WHAT'S WRONG.
Can someone please help me?
Last edited by leinad31; Mar 25th, 2003 at 07:20 AM.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|