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
LoadDocument
Posted by: Kushan Ratnayake (203.115.18.---)
Date: Wednesday, 22-Jan-2003, 07:22:28

Suppose I want to parse a document on a button click event of a Form. And I need to lock application from user events i.e. I want to avoid calling DoEvents() method.


LoadDocument( doc, docVal);
while ( doc.readyState != "complete")
{
Application.DoEvents(); // I dont want to process messages now sad smiley
}

If we use Thread.Sleep() instead of Application.DoEvents() the HTMLDocument class will not reach readyState = "complete"

Any Ideas?
Thanks in advance

Re: LoadDocument
Posted by: Tim Anderson (---.server.ntl.com)
Date: Wednesday, 22-Jan-2003, 08:01:13

Yes, the best way to do this is by handling the ReadyStateChanged event.

A way to do this is to have a private field in your class, say for example:

bool doParse = false;

Then in your button event handler you have this:

doParse = false;
LoadDocument(doc,docVal);
doParse = true;

Finally, in the ReadyStateChanged event handler:

if ((e.ReadyState = "complete") & doParse)
{
doParse = false;
//parse the document here
}

Tim



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.
wycEm
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.