Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

WebBrowser1 Invalid URI: The format of the URI could not be determined 1

Status
Not open for further replies.

lance59

IS-IT--Management
Mar 6, 2007
50
US
I have a modGlobal section that has web pages urls in it.

Module modGlobals
Public webpage1 As String = " Public webpage2 As String = " Public webpage3 As String = " Public webpage4 As String = "End Module

I want to display these pages in WebBrowser1, rotating through them every 10 seconds until I click a button that puts the text "Stop" in a textbox1 (best way I could figure to let the client stop it). So I have this:

Dim pages As Integer
Do Until TextBox1.Text = "Stop"
For pages = 1 To 4

Dim newpage As String
Dim pagenumber As String = Convert.ToString(pages)

newpage = "webpage" + pagenumber
Me.WebBrowser1.Url = New System.Uri(newpage)

Dim sw As New Stopwatch()
sw.Start()
Do Until sw.Elapsed.Seconds = 10
Application.DoEvents()
Loop
sw.Stop()
Next pages

Loop

I keep getting this error "Invalid URI: The format of the URI could not be determined" and I can't figure it out. I know that its putting in the text "webpage1", "webpage2", etc.. and not referencing the url. I just can't figure out how to get the url in.

TIA
 
may be
Code:
newpage = "webpage" + pagenumber
Me.WebBrowser1.Navigate(newpage)

________________________________________________________
Zameer Abdulla
Help to find Missing people
 
Thanks, that got me a little further along. I don't get the error but the web pages don't show up. I get error that web site can't be found. Again its looking for webpage2, not So its not pulling the data from the modGlobals module.

How do I reference the data?
 
Use an array instead. In your module, put:
Code:
Private WebPages As String() = New String(2) {"[URL unfurl="true"]http://www.google.com",[/URL] "[URL unfurl="true"]http://www.yahoo.com",[/URL] "[URL unfurl="true"]http://www.msn.com"}[/URL]

In your loop, put:
Code:
        Dim pages As Integer
        Do Until TextBox1.Text = "Stop"
            For pages = 0 To 2


                newpage = WebPages(pages)
                Me.WebBrowser1.Url = New System.Uri(newpage)
                
                Dim sw As New Stopwatch()
                sw.Start()
                Do Until sw.Elapsed.Seconds = 10
                    Application.DoEvents()
                Loop
                sw.Stop()
            Next pages

        Loop
 
Alright that did it. Thanks!!!

I had to change Private to Public and add Dim newpage As String, but other then that it worked!

Thanks!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top