Click here to Skip to main content
15,893,668 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
Please help how to convert below code using WPF in C#

While pageready = False
If WebBrowser1.ReadyState = WebBrowserReadyState.Complete Then
pageready = True
MessageBox.Show("Ready")
Else
pageready = False
Application.DoEvents()
End If

What I have tried:

While pageready = False
If WebBrowser1.ReadyState = WebBrowserReadyState.Complete Then
pageready = True
MessageBox.Show("Ready")
Else
pageready = False
Application.DoEvents()
End If
Posted
Updated 13-Feb-20 20:56pm

While (!pageready)
{
if (pageready = (WebBrowser1.ReadyState == WebBrowserReadyState.Complete))
MessageBox.Show("Ready");
Application.DoEvents();
}
 
Share this answer
 
Comments
Richard Deeming 14-Feb-20 9:04am    
C# is case-sensitive: the keyword is while, not While.

And you've changed the behaviour of the code. The original only called Application.DoEvents in the Else block, which is completely missing from your version.
Transcoding this to C# is trivial; there are only slight differences in syntax.

While I could do this in a manner of minutes, it would be best off for you to use MS Documentation so that you can learn the nuances

References:
while - C# Reference | Microsoft Docs[^]
if-else - C# Reference | Microsoft Docs[^]
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900