VS2005 WebBrowser Control

  • Thread starter Thread starter Adam Barker
  • Start date Start date
A

Adam Barker

Hi guys,

Noticed something strange and wondered if anyone had come across this. When
using the WebBrowser control, if I in any way access the
webBrowser1.Document object, I can no long type anything into any form
elements on the page. I can still navigate using the Tab key and hit buttons
with the Spacebar, but any other key seems to have become disabled.

Anyone noticed this before?

Thanks in advance

Adam
 
Just resolved this (yeah, I know it was only a couple of minutes!)

You have to call Dispose() on any references to element object within
WebBrowser.Document.

I was doing

foreach(HtmlElement elem in webBrowser1.Document.All)
{
listBox1.Items.Add(elem.TagName);
}

and it was screwing up.

But with

foreach(HtmlElement elem in webBrowser1.Document.All)
{
listBox1.Items.Add(elem.TagName);
elem.Dispose();
}

... it's fine.

Adam
 
Back
Top