BUG: Illegal Operation Err Using Richtext Control with Find (182573)
The information in this article applies to:
- Microsoft Visual FoxPro for Windows 5.0
- Microsoft Visual FoxPro for Windows 5.0a
- Microsoft Visual FoxPro for Windows 6.0
This article was previously published under Q182573 SYMPTOMS
If you insert the Microsoft ActiveX Richtext control version 5.0 into a
form, and you set the control to point to a text file, you can read the
text file through the control box normally. However, if you add a command
button that allows you to search the contents of the text box using the
Olecontrol1.Find method, the following error message occurs:
This program has performed an illegal operation and will be shutdown.
In Visual FoxPro 5.0, when you press the Details button this message
appears:
VFP caused a stack fault in module OLEAUT32.DLL at <memory address>.
In Visual FoxPro 5.0a, the following message appears:
VFP caused an invalid page fault in module OLEAUT32.DLL at <memory
address>.
RESOLUTION
Here is a workaround to solve the problem. This code example works like the
Find method of the Microsoft RichText control. Place the following sample
code in the Click event of the command button:
S=ALLTRIM(THISFORM.TEXT1.TEXT)&& Get string to find in richtext control
POS=AT_C(S,ThisForm.olecontrol1.TEXT) && Find the string in richtext box
IF (POS==0) && not found
WAIT WINDOW "NOT FOUND !"
ELSE
ls=left(ThisForm.olecontrol1.TEXT,pos-1) && Select string in richtext
pos=lenC(ls)
ThisForm.olecontrol1.SelStart = pos
ThisForm.olecontrol1.SelLength = lenc(s)
ENDIF
ThisForm.olecontrol1.SETFOCUS
STATUS
Microsoft has confirmed this to be a bug in the Microsoft products listed
at the beginning of this article.
Modification Type: | Major | Last Reviewed: | 8/17/1999 |
---|
Keywords: | kbprb KB182573 |
---|
|