Hey!

I have a question. It goes like this:

I have a webbrowser in one form. When I load a web page, there are buttons and text fields. I would like to get the "name" attribute of the item I click. For example I'll click on "submit" button.. then MessageBox.Show() will show me ButtonName from "<button name='ButtonName' value='Submit' />"

So far I have got this:

private void webBrowser1_DocumentCompleted(object sender, WebBrowserDocumentCompletedEventArgs e)
        {
            HtmlElement tags = webBrowser1.Document.ActiveElement;
            this.webBrowser1.Document.Click +=new HtmlElementEventHandler(element_Click); 
        }

        void element_Click(object sender, HtmlElementEventArgs e)
        {
            MessageBox.Show(sender.ToString());
        }

But it shows System.Windows.blabla.. not html element :/

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.