VS2005 WebBrowser Control

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
 
A

Adam Barker

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top