Here is some code in one of my methods:
webBrowser1.Focus();
System.Windows.Forms.SendKeys.Send("{PGDN}");
I'm using this to force the webbrowser to scroll down so that a picture on the site I'm using is on screen.
Then I use:
findClick();
I have coded this to mean: using(image1) find image on screen and click.
It works fine.
MY PROBLEM IS:
(here is the next line of code):
webBrowser1.Focus();
System.Windows.Forms.SendKeys.Send("{PGDN}");
Point one = this.Location;
How do I wait for a certain amount of time before executing the next line of command?
THREAD.SLEEP DOESN'T WORK!!!!!!!!!!
This command freezes the form and doesn't do anything for this problem. I also cannot use timers because I need the code to remain in this method (preferably in one line, like thread.Sleep)
How would I go about doing this?
ANOTHER SIMILAR PROBLEM:
using:
webBrowser1.Navigate("http://google.com");
second command;
third command;
This doesn't wait for the first command to finish so I would like to place a timer that says wait(5000) then continue.
I KNOW ABOUT DOCUMENTCOMPLETED events, I'm using this as an example!