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

c# - passing input text from view to contoller with FacebookContext using Facebook app -

ios - Does Core Data autoupdate a many to many relationship on saving -

Calling a C++ function from C# by passing a string with variable size to it -