Link to home
Create AccountLog in
Avatar of johnmoed
johnmoed

asked on

Pause program until page loads?

I am trying to finish a program that compares two pages to see if they are different or same. The program works fine if I seperate the two functions. If I combine the functions, the result is always different because the page from the web doesn't load fast enough.

Is there a way to pause the program until both pages are loaded? The program checks webpages for changes against a local copy of the page stored on my hard drive.
Avatar of Bob Learned
Bob Learned
Flag of United States of America image

Where are you doing this from?  Is this an ASP.NET or WinForms application?

Bob
Avatar of johnmoed
johnmoed

ASKER

This is a WinForms application. It connects to an SQL server that stores the filename and URL location. I have 2 textboxes, one that has the text from the saved file (I will probably stop saving the file and store the text in SQL) and the other contains the text from the URL. When the two pages are loaded, I have a function that compares the two textboxes, but, for some reason, the function runs before the URL text is loaded.

I was wondering if there is something that I can do to pause the program until the URL text is completely loaded.

Thanks,
John
How are you loading the URL?

Bob
Can you hide the form and show it when the page is loaded?
I load the page using:
AxWebBrowser1.Navigate(txtURL.Text)
I guess I could hide the form until the page is loaded, but I don't know how to do that... I am pretty much a beginner!

Would that make a difference though? It seems like the function is starting multiple threads for each command that I give and none waits until the other is finished. They all pop up out of my order.
ASKER CERTIFIED SOLUTION
Avatar of Bob Learned
Bob Learned
Flag of United States of America image

Link to home
membership
Create an account to see this answer
Signing up is free. No credit card required.
Create Account
SOLUTION
Link to home
membership
Create an account to see this answer
Signing up is free. No credit card required.
Create Account
I got this working with by moving the Check function to the AxWebbrowser1.DocumentComplete Function. I may need some additional tinkering.
I think that I will post another question with some more points for my other problem.

Thanks,
John