From: Leo on
Why am I getting this error for Me.ActiveControl.SelStart =
InStr(Me.ActiveControl.SelStart, Me.ActiveControl.text, m_FR.FindWhat)
- 1? If I replace Me.ActiveControl with the name of a textbox, it works
but I am using two textboxes that I switch between depending on weather
WordWrap is on or not.

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


From: Larry Serflaten on

"Leo" <ttdhead(a)gmail.com> wrote
> Why am I getting this error for Me.ActiveControl.SelStart =
> InStr(Me.ActiveControl.SelStart, Me.ActiveControl.text, m_FR.FindWhat)
> - 1? If I replace Me.ActiveControl with the name of a textbox, it works
> but I am using two textboxes that I switch between depending on weather
> WordWrap is on or not.

At the time of the error, what are the values of all those variables?

My bet is that SelStart is 0, which won't work because strings start at
position 1, so trying to start at position 0 raises an error....

:FS


From: Mayayana on
If Larry's thought doesn't solve the problem:
How do you know the active control isn't
a button when you make the call?

| Why am I getting this error for Me.ActiveControl.SelStart =
| InStr(Me.ActiveControl.SelStart, Me.ActiveControl.text, m_FR.FindWhat)
| - 1? If I replace Me.ActiveControl with the name of a textbox, it works
| but I am using two textboxes that I switch between depending on weather
| WordWrap is on or not.


From: Leo on
on 7/2/2010, Mayayana supposed :
> If Larry's thought doesn't solve the problem:
> How do you know the active control isn't
> a button when you make the call?
>
>> Why am I getting this error for Me.ActiveControl.SelStart =
>> InStr(Me.ActiveControl.SelStart, Me.ActiveControl.text, m_FR.FindWhat)
>> - 1? If I replace Me.ActiveControl with the name of a textbox, it works
>> but I am using two textboxes that I switch between depending on weather
>> WordWrap is on or not.

Because the app is a specialised text editor with only a menu a common
dialog and the textboxes.
The issue is sorted

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