how to make a loop wait

mourgent

New member
Joined
Nov 4, 2003
Messages
1
I am writting a program that opens up a website, and then is supposed to wait say...2 minutes for the user to look at the website, then to automatically go to a new website. Now I have a few questions...

To open IE i am using the command:

System.Diagnostics.Process.Start("http://www.yahoo.com")

Is there a better way to do that.

Also, what is the syntax to use to make the program wait...say... 120 seconds after going to that site before executing the next command.

Finally, I found that command via a google search. If i use the same command with a different address, will it open a new window or use the current one. I need it to keep the SAME window open and just change the URL. How would I go about doing that?

Any advice is appreciated.

Its kind of like an auto surfer that would give someone a tour of the basic sites on the net that everyone should know, like search engines, etc. Thats what Im going for. Any advice would be appreciated.


Thanks,
Weston
 
if you add a reference to " Microsoft Internet Controls " ( through project , add reference , COM ) then you can do this ...
Code:
    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        Dim thrd As New Threading.Thread(AddressOf LoadIE)
        thrd.Start()
    End Sub

    Private Sub LoadIE()
        Dim urls As String() = {"http://google.com", "http://yahoo.com", "http://msn.com"}
        Dim objIe As Object = CreateObject("InternetExplorer.Application")
        Dim ie As SHDocVw.InternetExplorer = DirectCast(objIe, SHDocVw.InternetExplorer)
        Dim x As Integer

        With ie
            .Height = 500
            .Width = 500
            .ToolBar = 0
            .Visible = True
        End With

        For x = 0 To 2
            ie.Navigate(urls(x))
            Threading.Thread.Sleep(5000) /// that was 5 seconds , but youd increase the time to your needs.
        Next
        ie = Nothing
    End Sub
 
Back
Top