Sounds like you might be having the same problem I had.
Click on this:
news://msnews.microsoft.com/ee******...TNGP02.phx.gbl
If your problem is similar to mine, then to get the DocumentComplete when it
loads, reference shdocvw (find the COM object DLL in
C:\Windows\System32\shdocvw.dll and reference it in your .NET app) and cast
your ((System.Windows.Forms.WebBrowser)webBrowser1).Act iveXObject to a
SHDocVw.WebBrowser variable. Then subscribe to the DocumentComplete event of
the COM object, rather than the DocumentComplete event of the Windows Forms
instance.
shdocvw.WebBrowser _ActiveXBrowser = null;
public shdocvw.WebBrowser ActiveXBrowser
{
get
{
if (_ActiveXBrowser == null)
{
_ActiveXBrowser =
(SHDocVw.WebBrowser)myWebBrowser.ActiveXInstance;
}
return _ActiveXBrowser;
}
}
private void InitBrowser()
{
_ActiveXBrowser.DocumentComplete += new
SHDocVw.DWebBrowserEvents2_DocumentCompleteEventHa ndler(ActiveXBrowser_DocumentComplete);
}
To avoid the re-load loop after changing the document content, set a flag in
your event handler to ignore the event if you just changed something.
Jon
"Robson Siqueira" <ro****@robsonfelix.comwrote in message
news:el**************@TK2MSFTNGP03.phx.gbl...
Actually I want to change the code after it is loaded, which happens after
the DocumentCompleted Event. The problem is that the application keeps
loading the file - if you change it goes all the way over again - and so
on.
Do you have any example in which you manipulate the HTML code AFTER the
document was loaded?
Thanks!
--
Regards,
Robson Siqueira
Enterprise Architect
"Ben Rush" <kw*****@yahoo.comwrote in message
news:%2****************@TK2MSFTNGP04.phx.gbl...
>Hi.
I've done a lot of code that resuses the IE control. I'm not sure what
you mean by "the application enters in a loop state", though. You mean
your code goes into a tight loop and the app freezes or what? If so,
don't do that... :-)
Can you give me an example of exactly what you're trying to change/do?
Perhaps something I can recreate on my end/write a quick piece of code as
an example for you?
--
~~~~~~~~~~~
Ben Rush
http://www.ben-rush.net/blog
"Robson Siqueira" <ro****@robsonfelix.comwrote in message
news:u3**************@TK2MSFTNGP06.phx.gbl...
>>Folks,
I am facing a problem. I am trying to manipulate the HTML data (thru the
Document and DocumentText properties) of the WebBrowser object
(System.Windows.Forms).
The problem is that the application enters in a loop state and my
changes don't apply.
Have somebody faced the same problem? Any solutions?
I am using C# / .Net 2.0.
--
Regards,
Robson Siqueira
Enterprise Architect