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?
a6106aAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

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
The Ultimate Tool Kit for Technolgy Solution Provi

Broken down into practical pointers and step-by-step instructions, the IT Service Excellence Tool Kit delivers expert advice for technology solution providers. Get your free copy for valuable how-to assets including sample agreements, checklists, flowcharts, and more!

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

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
a6106aAuthor Commented:
I'm sorry I can't give points to everyone who helped here. Thanks again to you.
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Visual Basic Classic

From novice to tech pro — start learning today.