0

Can you explain why I am receiving this error?

    private void startButton_Click(object sender, EventArgs e)
    {
        HtmlElement mainNav = webBrowser1.Document.GetElementByID("home");
            mainNav.InvokeMember("click");
    }

Error 1

'System.Windows.Forms.HtmlDocument' does not contain a definition for 'GetElementByID' and no extension method 'GetElementByID' accepting a first argument of type 'System.Windows.Forms.HtmlDocument' could be found (are you missing a using directive or an assembly reference?)
AndB
  • 139
  • 2
  • 13

1 Answers1

2

Because it's GetElementById, with a lowercase 'd'.

Documentation is at: http://msdn.microsoft.com/en-us/library/system.windows.forms.htmldocument.getelementbyid.aspx


Side note: A Google search on system.windows.forms.htmldocument led me right to the documentation to check, and Intellisense should also have been able to tell you the right spelling. I do realize it sometimes takes an extra pair of eyes, though.

lc.
  • 113,939
  • 20
  • 158
  • 187
  • 4
    @AndrewBrigance: Seems extreme. Maybe just a light slap to the face? :D – Ed S. Jan 02 '13 at 18:16
  • 1
    Like I said in my side note, sometimes it really takes extra eyes. Maybe it's just time for a break or more coffee? – lc. Jan 02 '13 at 18:16