From: Leo on
on 7/3/2010, Kevin Provance supposed :
> Do you want the code I wrote for that part of it? I don't mind sharing it.
> :-)
>
> --
> Customer Hatred Knows No Bounds at MSFT
> Free usenet access at http://www.eternal-september.org
> ClassicVB Users Regroup! comp.lang.basic.visual.misc
>
> Bawwk! Paulie want a dingleball, bawwk!
> "Leo" <ttdhead(a)gmail.com> wrote in message
> news:i0knvr$pq3$1(a)news.eternal-september.org...
>> It happens that Karl E. Peterson formulated :
>>> Karl E. Peterson submitted this idea :
>>>> Long story, short, here's the result:
>>>>
>>>> http://vb.mvps.org/samples/_beta/FindReplace.zip
>>>
>>> Just updated, adding support for the ShowHelp flag, including a new event
>>> when that button is clicked.
>>
>> An overall issue I seem to have found, seting sellength in the findnext
>> event causes the text to be highlihted but it's not visibly highlighted
>> the same with seting selstart. They get visually set after the box
>> closes though. I am using a multiline Standard textbox. Ill post the
>> code once I add code that checks the case , the updown buttons and the
>> wholeword checkbox.
>>
>> --
>> ClassicVB Users Regroup! comp.lang.basic.visual.misc
>> Free usenet access at http://www.eternal-september.org
>>
>>

Yes please.

--
ClassicVB Users Regroup! comp.lang.basic.visual.misc
Free usenet access at http://www.eternal-september.org


From: Leo on
Kevin Provance presented the following explanation :
> Do you want the code I wrote for that part of it? I don't mind sharing it.
> :-)
>
> --
> Customer Hatred Knows No Bounds at MSFT
> Free usenet access at http://www.eternal-september.org
> ClassicVB Users Regroup! comp.lang.basic.visual.misc
>
> Bawwk! Paulie want a dingleball, bawwk!
> "Leo" <ttdhead(a)gmail.com> wrote in message
> news:i0knvr$pq3$1(a)news.eternal-september.org...
>> It happens that Karl E. Peterson formulated :
>>> Karl E. Peterson submitted this idea :
>>>> Long story, short, here's the result:
>>>>
>>>> http://vb.mvps.org/samples/_beta/FindReplace.zip
>>>
>>> Just updated, adding support for the ShowHelp flag, including a new event
>>> when that button is clicked.
>>
>> An overall issue I seem to have found, seting sellength in the findnext
>> event causes the text to be highlihted but it's not visibly highlighted
>> the same with seting selstart. They get visually set after the box
>> closes though. I am using a multiline Standard textbox. Ill post the
>> code once I add code that checks the case , the updown buttons and the
>> wholeword checkbox.
>>
>> --
>> ClassicVB Users Regroup! comp.lang.basic.visual.misc
>> Free usenet access at http://www.eternal-september.org
>>
>>

Did you miss my last reply? :D Yes please, I would like to see your
code.

--
ClassicVB Users Regroup! comp.lang.basic.visual.misc
Free usenet access at http://www.eternal-september.org


From: Leo on
Leo has brought this to us :
> Kevin Provance presented the following explanation :
>> Do you want the code I wrote for that part of it? I don't mind sharing it.
>> :-)
>>
>> -- Customer Hatred Knows No Bounds at MSFT
>> Free usenet access at http://www.eternal-september.org
>> ClassicVB Users Regroup! comp.lang.basic.visual.misc
>>
>> Bawwk! Paulie want a dingleball, bawwk!
>> "Leo" <ttdhead(a)gmail.com> wrote in message
>> news:i0knvr$pq3$1(a)news.eternal-september.org...
>>> It happens that Karl E. Peterson formulated :
>>>> Karl E. Peterson submitted this idea :
>>>>> Long story, short, here's the result:
>>>>>
>>>>> http://vb.mvps.org/samples/_beta/FindReplace.zip
>>>>
>>>> Just updated, adding support for the ShowHelp flag, including a new
>>>> event
>>>> when that button is clicked.
>>>
>>> An overall issue I seem to have found, seting sellength in the findnext
>>> event causes the text to be highlihted but it's not visibly highlighted
>>> the same with seting selstart. They get visually set after the box
>>> closes though. I am using a multiline Standard textbox. Ill post the
>>> code once I add code that checks the case , the updown buttons and the
>>> wholeword checkbox.
>>>
>>> -- ClassicVB Users Regroup! comp.lang.basic.visual.misc
>>> Free usenet access at http://www.eternal-september.org
>>>
>>>
>
> Did you miss my last reply? :D Yes please, I would like to see your code.

Well I thought id have another look at finishing my attempt and hear it
is:
Private Function Find(start As Long, FindIn As String, pFindWhat As
String, MatchCase As Boolean, Down As Boolean) As Long
Dim lStrPos As Long
Select Case start
Case 0
If MatchCase = True Then
If Down = True Then
lStrPos = InStr(start + 1, FindIn, pFindWhat,
vbBinaryCompare)
Else
lStrPos = InStrRev(FindIn, pFindWhat, start + 1,
vbBinaryCompare)
End If
Else
If Down = True Then
Find = InStr(start + 1, FindIn, pFindWhat,
vbTextCompare) - 1
lStrPos = InStr(start + 1, FindIn, pFindWhat,
vbTextCompare)
Else
Find = InStrRev(FindIn, pFindWhat, start + 1,
vbTextCompare) - 1
lStrPos = InStrRev(FindIn, pFindWhat, start + 1,
vbTextCompare)
End If
End If
If lStrPos <= -1 Then
MsgBox "Can not find " & pFindWhat, vbOKOnly +
vbInformation
Else
Debug.Print "Found at "; lStrPos
Find = lStrPos - 1
End If
Case Len(FindIn)
MsgBox "Can not find " & pFindWhat, vbOKOnly + vbInformation
Case Else
If m_FR.MatchCase = True Then
If Down = True Then
lStrPos = InStr(start, FindIn, pFindWhat,
vbBinaryCompare)
Else
lStrPos = InStrRev(FindIn, pFindWhat, start,
vbBinaryCompare)
End If
Else
If Down = True Then
lStrPos = InStr(start, FindIn, pFindWhat, vbTextCompare)
Else
lStrPos = InStrRev(FindIn, pFindWhat, start,
vbTextCompare)
End If
End If
If lStrPos <= -1 Then
MsgBox "Can not find " & pFindWhat, vbOKOnly +
vbInformation
Else
Debug.Print "Started searching in the middle of the file"
Debug.Print "Found at "; lStrPos
Find = lStrPos
End If
End Select
End Function

--
ClassicVB Users Regroup! comp.lang.basic.visual.misc
Free usenet access at http://www.eternal-september.org


From: Leo on
Leo submitted this idea :
> Leo has brought this to us :
>> Kevin Provance presented the following explanation :
>>> Do you want the code I wrote for that part of it? I don't mind sharing
>>> it. :-)
>>>
>>> -- Customer Hatred Knows No Bounds at MSFT
>>> Free usenet access at http://www.eternal-september.org
>>> ClassicVB Users Regroup! comp.lang.basic.visual.misc
>>>
>>> Bawwk! Paulie want a dingleball, bawwk!
>>> "Leo" <ttdhead(a)gmail.com> wrote in message
>>> news:i0knvr$pq3$1(a)news.eternal-september.org...
>>>> It happens that Karl E. Peterson formulated :
>>>>> Karl E. Peterson submitted this idea :
>>>>>> Long story, short, here's the result:
>>>>>>
>>>>>> http://vb.mvps.org/samples/_beta/FindReplace.zip
>>>>>
>>>>> Just updated, adding support for the ShowHelp flag, including a new
>>>>> event
>>>>> when that button is clicked.
>>>>
>>>> An overall issue I seem to have found, seting sellength in the findnext
>>>> event causes the text to be highlihted but it's not visibly highlighted
>>>> the same with seting selstart. They get visually set after the box
>>>> closes though. I am using a multiline Standard textbox. Ill post the
>>>> code once I add code that checks the case , the updown buttons and the
>>>> wholeword checkbox.
>>>>
>>>> -- ClassicVB Users Regroup! comp.lang.basic.visual.misc
>>>> Free usenet access at http://www.eternal-september.org
>>>>
>>>>
>>
>> Did you miss my last reply? :D Yes please, I would like to see your code.
>
> Well I thought id have another look at finishing my attempt and hear it is:
> Private Function Find(start As Long, FindIn As String, pFindWhat As String,
> MatchCase As Boolean, Down As Boolean) As Long
> Dim lStrPos As Long
> Select Case start
> Case 0
> If MatchCase = True Then
> If Down = True Then
> lStrPos = InStr(start + 1, FindIn, pFindWhat, vbBinaryCompare)
> Else
> lStrPos = InStrRev(FindIn, pFindWhat, start + 1,
> vbBinaryCompare)
> End If
> Else
> If Down = True Then
> Find = InStr(start + 1, FindIn, pFindWhat, vbTextCompare) - 1
> lStrPos = InStr(start + 1, FindIn, pFindWhat, vbTextCompare)
> Else
> Find = InStrRev(FindIn, pFindWhat, start + 1, vbTextCompare) -
> 1
> lStrPos = InStrRev(FindIn, pFindWhat, start + 1,
> vbTextCompare)
> End If
> End If
> If lStrPos <= -1 Then
> MsgBox "Can not find " & pFindWhat, vbOKOnly + vbInformation
> Else
> Debug.Print "Found at "; lStrPos
> Find = lStrPos - 1
> End If
> Case Len(FindIn)
> MsgBox "Can not find " & pFindWhat, vbOKOnly + vbInformation
> Case Else
> If m_FR.MatchCase = True Then
> If Down = True Then
> lStrPos = InStr(start, FindIn, pFindWhat, vbBinaryCompare)
> Else
> lStrPos = InStrRev(FindIn, pFindWhat, start, vbBinaryCompare)
> End If
> Else
> If Down = True Then
> lStrPos = InStr(start, FindIn, pFindWhat, vbTextCompare)
> Else
> lStrPos = InStrRev(FindIn, pFindWhat, start, vbTextCompare)
> End If
> End If
> If lStrPos <= -1 Then
> MsgBox "Can not find " & pFindWhat, vbOKOnly + vbInformation
> Else
> Debug.Print "Started searching in the middle of the file"
> Debug.Print "Found at "; lStrPos
> Find = lStrPos
> End If
> End Select
> End Function

Here is an update:
Private Function Find(start As Long, FindIn As String, pFindWhat As
String, MatchCase As Boolean, Down As Boolean) As Long
Dim lStrPos As Long
Select Case start
Case 0
If MatchCase = True Then
If Down = True Then
lStrPos = InStr(start + 1, FindIn, pFindWhat,
vbBinaryCompare)
Else
lStrPos = InStrRev(FindIn, pFindWhat, start + 1,
vbBinaryCompare)
End If
Else
If Down = True Then
Find = InStr(start + 1, FindIn, pFindWhat,
vbTextCompare) - 1
lStrPos = InStr(start + 1, FindIn, pFindWhat,
vbTextCompare)
Else
Find = InStrRev(FindIn, pFindWhat, start + 1,
vbTextCompare) - 1
lStrPos = InStrRev(FindIn, pFindWhat, start + 1,
vbTextCompare)
End If
End If
If lStrPos <= -1 Then
MsgBox "Can not find " & pFindWhat, vbOKOnly +
vbInformation
Else
Debug.Print "Found at "; lStrPos
Find = lStrPos - 1
End If
Case Len(FindIn)
MsgBox "Can not find " & pFindWhat, vbOKOnly + vbInformation
Case Else
If m_FR.MatchCase = True Then
If Down = True Then
lStrPos = InStr(start, FindIn, pFindWhat,
vbBinaryCompare)
Else
lStrPos = InStrRev(FindIn, pFindWhat, start,
vbBinaryCompare)
End If
Else
If Down = True Then
lStrPos = InStr(start, FindIn, pFindWhat, vbTextCompare)
Else
lStrPos = InStrRev(FindIn, pFindWhat, start,
vbTextCompare)
End If
End If
If lStrPos <= -1 Then
MsgBox "Can not find " & pFindWhat, vbOKOnly +
vbInformation
Else
Debug.Print "Started searching in the middle of the file"
Debug.Print "Found at "; lStrPos
Find = lStrPos - 1
End If
End Select
End Function

--
ClassicVB Users Regroup! comp.lang.basic.visual.misc
Free usenet access at http://www.eternal-september.org


From: Leo on
Karl E. Peterson submitted this idea :
> Karl E. Peterson submitted this idea :
>> Long story, short, here's the result:
>>
>> http://vb.mvps.org/samples/_beta/FindReplace.zip
>
> Just updated, adding support for the ShowHelp flag, including a new event
> when that button is clicked.

Hi Karl, the Replace and ReplaceAll events do not seem to be firing
correctly for me. When I click the respective buttons it seems the code
in my Find event is firing instead. I am not calling the find event
from the replace evnts.

--
ClassicVB Users Regroup! comp.lang.basic.visual.misc
Free usenet access at http://www.eternal-september.org