Visual Basic Code , VB.NET Code, VB Code
  Home   :  Code   :  Forums   :  Submit   :  Mailing List   :  About   :  Contact


How to determine the Url of the current Webbrowser page.


How to determine the Url of the current Webbrowser page.

Author
Message
tonyallan8128
tonyallan8128
Forum God
Forum God (1.1K reputation)Forum God (1.1K reputation)Forum God (1.1K reputation)Forum God (1.1K reputation)Forum God (1.1K reputation)Forum God (1.1K reputation)Forum God (1.1K reputation)Forum God (1.1K reputation)Forum God (1.1K reputation)

Group: Forum Members
Posts: 3, Visits: 14
I am writing some code to navigate to a particular web page determined by the current page webbrowser1 is on.

That is, if it was on one page go to a certain page, but if it was on another page go to a different page.

So I need to be able to return the URL of the current page in webbrowser1.



What do i put in the messagebox.show field to display current web page?



Any help would be appreciated.





*********************************************************************



Imports System.Net 'For webrequest and webresponce

Imports System.IO ' To read data stream





Public Class Form1



Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load

Dim i As Integer

Dim UserID As String = "user id"

Dim Password As String = "user password"





'This logs on to Site and enters User ID, Password



WebBrowser1.Navigate("web page")

For i = 1 To 300000000

Next

Do While WebBrowser1.ReadyState <> WebBrowserReadyState.Complete

Application.DoEvents()

Loop



'Inputs ID

WebBrowser1.Document.GetElementById("UserID").SetAttribute("Value", UserID)



'Inputs Password

WebBrowser1.Document.GetElementById("Password").SetAttribute("Value", Password)



'Submits information

WebBrowser1.Document.GetElementById("LogonForm").InvokeMember("submit")

For i = 1 To 300000000

Next



MessageBox.Show(WebBrowser1.Url) 'this brings System.Uri can not convert to string.







End Sub

End Class
Edited
6/30/2013 by tonyallan8128
tonyallan8128
tonyallan8128
Forum God
Forum God (1.1K reputation)Forum God (1.1K reputation)Forum God (1.1K reputation)Forum God (1.1K reputation)Forum God (1.1K reputation)Forum God (1.1K reputation)Forum God (1.1K reputation)Forum God (1.1K reputation)Forum God (1.1K reputation)

Group: Forum Members
Posts: 3, Visits: 14
MessageBox.Show(WebBrowser1.Url.ToString)
GO


Similar Topics


Reading This Topic


Login
Existing Account
Email Address:


Password:


Social Logins

Select a Forum....

















A1VBCode Forums


Search