Click here to Skip to main content
15,919,331 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I use the c # webbrowser controls to load web pages, and now I should finish the rest of the web page loading, and after finished loading I will toggle button. But now the operation has been in circulation, how to solve?
My source is:
while (webBrowser1.ReadyState != WebBrowserReadyState.Complete)
            {
                Console.WriteLine("miao2");
                Application.DoEvents();
            }
            Console.WriteLine("miao3");
            HtmlElement Sumiaobut = this.webBrowser1.Document.GetElementById("submitFormBtnA");
                        Sumiaobut.InvokeMember("Click");


After the operation, and has been in “miao2 ”output character, not "miao3" output characters
Posted
Updated 9-Oct-10 15:41pm
v3

1 solution

Hi

everthing in your code is correct just USE IF conditional loop and modify condition as below

if (webBrowser1.ReadyState == WebBrowserReadyState.Complete)
{
Console.WriteLine("miao2");                
Application.DoEvents();

}
else
{
Console.WriteLine("miao3");           
HtmlElement Sumiaobut = this.webBrowser1.Document.GetElementById(submitFormBtnA);                      
Sumiaobut.InvokeMember("Click");
}
 
Share this answer
 
Comments
gemeite 8-Oct-10 5:55am    
Thank you for your reply

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