This is the discussion forum for the HtmlEditor. See also the
HtmlEditor home page, where you can download the control, and the
Documentation Wiki, a collaborative project for documenting the control.
FindText
Posted by:
Scott (129.230.248.---)
Date: Friday, 30-May-2008, 15:44:29
With the latest svn code, that does not use the Primary Interop, is it possible to get FindText working? I have:
public void FindText(string text)
{
IHTMLTxtRange txtRange = ((IHTMLBodyElement)HtmlDocument2.GetBody()).createTextRange();
bool found = false;
found = txtRange.findText(text, 0, 0);
if(found)
{
txtRange.select();
}
}
in HtmlEditor and it throws a NullReferenceException on the txtRange.findText line. Strange exception I thought as neither txtRange nor text are null
Re: FindText
Posted by:
Tim (Moderator)
Date: Friday, 04-Jul-2008, 16:01:38
I tried this code using the version without the primary interop assembly (which is the one that is still under development) and it worked OK.
I had to amend the interface declaration for IHTMLTxtRange. I changed temp18 to this:
[DispId(dispids.DISPID_IHTMLTXTRANGE_FINDTEXT)]
[return: MarshalAs(UnmanagedType.Bool)]
bool findText(
[In, MarshalAs(UnmanagedType.BStr)]
string theString,int count,int flags
);
Worth a try?
Tim