Alex

Alex

  • NA
  • 1
  • 0

Object reference error with HTMLELEMENTCOLLECTION

May 31 2009 5:18 PM
Hey guys

I'm currently creating a program, would rather not go into detail, however the problem I'm having is getting the captcha image (which I can do), putting it in a picturebox (which I can do), create a popup using another form with the picturebox on the popup showing the captcha and a textbox on the popup for entering the captcha code..

I can do everything perfectly easily, the captcha image is displayed with no problems, however, once I enter the captcha into the textbox and press the "done" button to send the captcha text into the webbrowser control to verify it and go on with the rest of the program, I get an error.

"Object reference not set to an instance of an object."

The line of code for this error:

HtmlElementCollection col = f1.webBrowser1.Document.GetElementsByTagName("input");

f1 is an instance of Form1...

I know what this means, and normall I could fix this. however I don't see what the problem is and how I can fix it. If anyone thinks they can help me, please PM me or reply here, and we could talk in more detail.