c# - InvalidCastException when not casting -


I am using the winforms Webbrowser control to load a webpage, and for this Waiting for the page to load. So I have a time loop that checks the ReadyState property, but it's a InvalidCastException Throwing

I do not understand why I see this error because I am not casting anybody And casting is not necessary because these variables like the value of the same type.

Anyone put some light on this?

Code below:

  while (wb.ReadyState! = WebBrowserReadyState.Complete) {Thread. Sleep (2500); }   

Edit:

Screenshot of Exceptions window

Why do not you just subscribe to an event instead of using a loop?

  Private zeros wb_DocumentCompleted (Object Sender, EventArgs E) {// stuff after loading page}    

Comments

Popular posts from this blog

Java - Error: no suitable method found for add(int, java.lang.String) -

java - JPA TypedQuery: Parameter value element did not match expected type -

c++ - static template member variable has internal linkage but is not defined -