• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 168
  • Last Modified:

How do I make the current URL appear in the titlebar

My app uses the IE Browser control to display websites. I need the current URL to appear in the title bar of the form. How can I do this?
0
a6106a
Asked:
a6106a
  • 3
  • 3
  • 2
  • +1
1 Solution
 
tureCommented:
Something like this?

Private Sub WebBrowser1_NavigateComplete2(ByVal pDisp As Object, URL As Variant)
  Me.Caption = URL
End Sub

Ture Magnusson
Karlstad, Sweden
0
 
LeXienCommented:
go does this:

frmMain.caption = "My Web Browser is located at - " & WebBrowserControl.URL

Thats should work - i have personally never used to control so i dont know what your control is called - Replace 'WebBrowserControl' with the controls name and that should work.
0
 
a6106aAuthor Commented:
Lexien: The Web Browser Object (the Globe) doesn't have the URL property:
Tuer: Please tell me how to insert your code. I'm not too proficient. I've tried it several places but can't make it work.
0
Never miss a deadline with monday.com

The revolutionary project management tool is here!   Plan visually with a single glance and make sure your projects get done.

 
tureCommented:
a6106a,

This shoulddn't be that difficult...

1. Show the form that contains your web browser object.
2. Double-click the web-browser object on the form.

(You will see the form's code window.)

3. Above the code window are two listboxes. In the second listbox, choose 'NavigateComplete2'.

Now enter this code inside the xxxxx_NavigateComplete2 procedure:

Me.Caption = URL

/Ture
0
 
MazerCommented:
Okay I will post two different Solutions.

1)Getting the Name of the web site on the title bar.

Create a: Form, WebBrowser Control

Size the form to the size you want, next draw the WebBrowser control to the size you want. Next double click on the form and past this code.

Private Sub Form_Load()
WebBrowser1.Navigate "http://www.msn.com"
End Sub

Private Sub WebBrowser1_NavigateComplete2(ByVal pDisp As Object, URL As Variant)
Form1.Caption = WebBrowser1.LocationName
End Sub

This will open the MSN web site in your browser control, and display the Web Pages title as your Forms Caption.

2)Getting the Address of the web site on the title bar.

Create a: Form, WebBrowser Control

Size the form to the size you want, next draw the WebBrowser control to the size you want. Next double click on the form and past this code.

Private Sub Form_Load()
WebBrowser1.Navigate "http://www.msn.com"
End Sub

Private Sub WebBrowser1_NavigateComplete2(ByVal pDisp As Object, URL As Variant)
Form1.Caption = WebBrowser1.LocationURL
End Sub

This will open the MSN web site in your browser control, and display the Web Pages address on your Forms Caption.


0
 
LeXienCommented:
k, sorry - like i said i've never used the WebBrowser control before.

merry xmas

;)
0
 
a6106aAuthor Commented:
mazur: please answer. yours worked fine for me.
thank you to all for your help.
0
 
tureCommented:
a6106a,

Didn't my suggestion work? Or perhaps I diddn't explain myself clearly enough?

/Ture
0
 
MazerCommented:
a6106a, Did the code that I posted work for you?  It works fine for me with the exception of a few things.  Which when I figure them out I will post them as well, if you like.
0
 
a6106aAuthor Commented:
I'm sorry I can't give points to everyone who helped here. Thanks again to you.
0

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

  • 3
  • 3
  • 2
  • +1
Tackle projects and never again get stuck behind a technical roadblock.
Join Now