public sub command1_click()
dim foundpos as integer
if fstring = "" then
fstring = text1.text
else
if text1.text <> fstring and text1.text <> "" then
fstring = text1.text
end if
end if
if option1.value = true then
endpos = form1.text1.selstart
form1.text1.selstart = 0
startpos = 0
do while foundpos <> -1
if check1.value = 1 then
foundpos = form1.text1.find(fstring, startpos, endpos, 4)
if foundpos <> -1 then startpos = foundpos + len(fstring)
else
foundpos = form1.text1.find(fstring, startpos, endpos)
if foundpos <> -1 then startpos = foundpos + len(fstring)
end if
loop
if startpos = 0 then
' startpos = startpos - len(fstring)
' else
msgbox "find not " + chr(34) + fstring + chr(34)
end if
else
startpos = form1.text1.selstart + form1.text1.sellength
endpos = len(form1.text1)
if check1.value = 1 then
foundpos = form1.text1.find(fstring, startpos, endpos, 4)
else
foundpos = form1.text1.find(fstring, startpos, endpos)
end if
if foundpos <> -1 then
startpos = foundpos + 1
else
msgbox "find not " + chr(34) + fstring + chr(34)
end if
end if
end sub
private sub command2_click()
form2.visible = false
end sub
private sub form_load()
command1.enabled = false
tchange = false
endpos = lenb(form1.text1)
end sub
private sub text1_change()
if text1.text <> "" then
command1.enabled = true
else
command1.enabled = false
end if
tchange = true
end sub