Click here to Skip to main content
15,902,299 members
Home / Discussions / C#
   

C#

 
GeneralRe: A question about async call of an assembly... Pin
Orkun GEDiK16-Oct-06 4:14
Orkun GEDiK16-Oct-06 4:14 
QuestionExtracting OLE Object from MS Access Pin
AngryC15-Oct-06 8:56
AngryC15-Oct-06 8:56 
AnswerRe: Extracting OLE Object from MS Access Pin
Nader Elshehabi15-Oct-06 14:01
Nader Elshehabi15-Oct-06 14:01 
GeneralRe: Extracting OLE Object from MS Access Pin
AngryC15-Oct-06 14:34
AngryC15-Oct-06 14:34 
GeneralRe: Extracting OLE Object from MS Access Pin
Nader Elshehabi15-Oct-06 14:49
Nader Elshehabi15-Oct-06 14:49 
GeneralRe: Extracting OLE Object from MS Access Pin
AngryC15-Oct-06 16:01
AngryC15-Oct-06 16:01 
GeneralRe: Extracting OLE Object from MS Access [modified] Pin
Nader Elshehabi15-Oct-06 16:24
Nader Elshehabi15-Oct-06 16:24 
QuestionWebBrowser/Threading issue Pin
DMBFiredancer15-Oct-06 8:34
DMBFiredancer15-Oct-06 8:34 
I'm trying to parse html that resides locally by using the HtmlDocument class
and unfortunately you can only get an instance of an HtmlDocument through the
WebBrowser control.

Some of the html files I want to parse are quite large so I want to get the
HtmlDocument in a separate thread. But for some reason, whenever I move the
code to navigate the WebBrowser to a separate thread the DocumentCompleted
event is never fired. When I step through I can see that some of it is
loading but not all. Here is some code:
-----------
...<br />
//Start the thread<br />
Thread worker = new Thread(new ParameterizedThreadStart(LoadHtml));<br />
worker.SetApartmentState(ApartmentState.STA);<br />
worker.Start(files);<br />
...<br />
<br />
private void LoadHtml(object obj)<br />
{<br />
            foreach(FileInfo fileinfo in (FileInfo[])obj)<br />
            {<br />
                //Create a new chapter and add it to the list of chapters<br />
                HtmlParser parser = new HtmlParser(fileinfo);<br />
                m_listHtmlParsers.Add(parser);<br />
            }<br />
}<br />
<br />
public class HtmlParser<br />
{<br />
        public HtmlParser(FileInfo fileinfo)<br />
        {<br />
            //Set up our WebBrowser Control, which will Parse the HtmlDocument<br />
            //that it contains once the DocumentCompleted Event is fired<br />
            m_wbHtmlParser.DocumentCompleted +=<br />
                new WebBrowserDocumentCompletedEventHandler(ParseHtml);<br />
            m_wbHtmlParser.Navigate(m_fiChapterFile.FullName);<br />
        }<br />
<br />
        private void ParseHtml(object sender, <br />
ebBrowserDocumentCompletedEventArgs e)<br />
        {<br />
         //We never get here<br />
        }<br />
}<br />

------------------
If I take this out of the thread, the DocuementCompleted event get's fired
and everything works. I think what is happening is that the thread is being
exited before the document is completely loaded. But I'm not sure how to
make sure all the HtmlParsers have fired the DocumentCompleted event before
the thread ends.

Any help would be greatly appreciated.
AnswerRe: WebBrowser/Threading issue Pin
Judah Gabriel Himango15-Oct-06 10:44
sponsorJudah Gabriel Himango15-Oct-06 10:44 
GeneralRe: WebBrowser/Threading issue Pin
DMBFiredancer15-Oct-06 11:15
DMBFiredancer15-Oct-06 11:15 
GeneralRe: WebBrowser/Threading issue Pin
Judah Gabriel Himango15-Oct-06 11:17
sponsorJudah Gabriel Himango15-Oct-06 11:17 
GeneralRe: WebBrowser/Threading issue Pin
DMBFiredancer15-Oct-06 11:51
DMBFiredancer15-Oct-06 11:51 
GeneralRe: WebBrowser/Threading issue Pin
Judah Gabriel Himango15-Oct-06 12:24
sponsorJudah Gabriel Himango15-Oct-06 12:24 
GeneralRe: WebBrowser/Threading issue Pin
DMBFiredancer15-Oct-06 12:30
DMBFiredancer15-Oct-06 12:30 
GeneralRe: WebBrowser/Threading issue Pin
DMBFiredancer16-Oct-06 2:44
DMBFiredancer16-Oct-06 2:44 
GeneralRe: WebBrowser/Threading issue Pin
Judah Gabriel Himango16-Oct-06 3:39
sponsorJudah Gabriel Himango16-Oct-06 3:39 
QuestionClient server application Pin
Airtel_nokia15-Oct-06 8:09
Airtel_nokia15-Oct-06 8:09 
QuestionWhy use CulturalInfo Pin
Mark0615-Oct-06 8:00
Mark0615-Oct-06 8:00 
AnswerRe: Why use CulturalInfo Pin
Guffa15-Oct-06 12:36
Guffa15-Oct-06 12:36 
AnswerRe: Why use CulturalInfo Pin
Monkeyget216-Oct-06 1:50
Monkeyget216-Oct-06 1:50 
GeneralRe: Why use CulturalInfo Pin
Mark0617-Oct-06 0:49
Mark0617-Oct-06 0:49 
GeneralRe: Why use CulturalInfo Pin
Monkeyget220-Oct-06 8:13
Monkeyget220-Oct-06 8:13 
Questionexit event handler Pin
m.m._200715-Oct-06 6:53
m.m._200715-Oct-06 6:53 
AnswerRe: exit event handler Pin
CWIZO15-Oct-06 7:58
CWIZO15-Oct-06 7:58 
AnswerRe: exit event handler Pin
sam#15-Oct-06 8:26
sam#15-Oct-06 8:26 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.