|
-
Mar 11th, 2001, 07:52 PM
#1
Thread Starter
Hyperactive Member
ok the following code searches a string but once carried out it will not search for a second occurence if called again ...
Dim StartPos As Long
StartPos = InStr(1, rich.Text, "cat")
''''the proble is that 1 because every time the code is called it will begin to search from the start''''
If StartPos <> 0 Then
rich.SelStart = StartPos - 1
rich.SelLength = Len("cat")
rich.SetFocus
End If
i tried making another variable to be static and hold the startpos but it doesn't work ... how do those programs have 2 options of "find" and "find next" ... how do they remember the last position without it being deleted from memory?
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
|