elnaz z

elnaz z

  • NA
  • 14
  • 83.4k

problem in vb to C# converter

Apr 18 2011 5:21 AM
hi all
i hava a piece vb code
i convert it to c# but when it convert to C# i have error in my program
can anybody help me?

vb code(this code is true)
Do Until vreadyState = 4
                  Application.DoEvents()
                  vreadyState = Me.WebBrowser1.ReadyState
            Loop
            Dim eleminput As HtmlElementCollection
            Dim DocCol As HtmlDocument
            DocCol = WebBrowser1.Document
            eleminput = DocCol.GetElementsByTagName("input")



c# code
for (; (vreadystate == 4); )
                  {
                        Application.DoEvents();
                        vreadystate = Convert.ToInt32(this.webBrowser1.ReadyState);

                  }
                  HtmlElementCollection eleminput = default(HtmlElementCollection);
                  HtmlDocument DocCol = default(HtmlDocument);
                  DocCol = webBrowser1.Document;
                  eleminput =DocCol.GetElementsByTagName("input");

run this code
but my program has error in last line
"Object reference not set to an instance of an object."

how to change this code that solve this error?

Answers (6)