我要实现连续向上查找
以下是我的向上查找代码:If OptUp.Value = True Then
st = Trim(TxtFind.Text) '要查找的字符串
ln = Len(st) '要查找的字符串长度
p = InStrRev(Main.Txt.Text, st)
If p > 0 Then
Main.Txt.SetFocus
Main.Txt.SelStart = p - 1
Main.Txt.SelLength = ln
find = True
Else
find = False
MsgBox "找不到" + st, vbOKOnly + vbExclamation, "记事本"
End If
End If还有就是如何在向下查找的时候查找到第N个结果的时候,向上查找,是查找当前字符的上一个字符,而不是用向上查找的时候就直接反回到最后查找,从最面开始查找的.
p=instrrev(p+1,main.txt.text,st)instr也同理