HtmlEditor :  Phorum 5 The fastest message board... ever.

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.

Goto Thread: PreviousNext
Goto: Forum ListMessage ListNew TopicSearchLog In
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: Prabhath (---.maa.sify.net)
Date: Wednesday, 02-Jul-2008, 07:23:46

Hello Scott,

I am also having the same problem while doing the findText(). If you have find any solution for this then provide it.

Thanks in advance,
Prabhath.

Re: FindText
Posted by: Tim (Moderator)
Date: Friday, 04-Jul-2008, 15:18:16

I'll have a look.

Tim

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

Re: FindText
Posted by: Scott (129.230.248.---)
Date: Wednesday, 23-Jul-2008, 16:09:18

Great,

That works for me. Thanks



Your Name: 
Your Email: 
Subject: 
Spam prevention:
Please, enter the code that you see below in the input field. This is for blocking bots that try to post this form automatically.
mjH7W
This is a moderated forum. Your message will remain hidden until it has been approved by a moderator or administrator
This forum powered by Phorum.