|
-
Jan 26th, 2005, 06:03 AM
#1
Thread Starter
Junior Member
How to create an 'Internet Explorer' Object using Webbrowser control
Hi there,
I want to use the webbrowser control to launch an internet explorer object from a VB6 form, then control it...
I really don't know how to do it.. I tried many things like below after adding the 'MS Internet controls library' :
Set moIE = New InternetExplorer
... or ...
Dim MyBrowser As SHDocVw.InternetExplorer
Set MyBrowser = New SHDocVw.InternetExplorer
And it doesn't work... help please 
Sirius
-
Jan 26th, 2005, 06:31 AM
#2
Member
Re: How to create an 'Internet Explorer' Object using Webbrowser control
hi
all you need is one line, first draw a square using the webbroswer tool and put the code in form load or put it into a command button
obviously you can replace the text inside the "" by a text box ie text1
WebBrowser1.Navigate ("http://www.yahoo.com")
hope this helps
also using the keywords of webbrowser such as "GOFORWARD,GOBACK" etc etc you can link them to command buttons
-
Jan 26th, 2005, 08:10 AM
#3
Thread Starter
Junior Member
Re: How to create an 'Internet Explorer' Object using Webbrowser control
Thx for your answer... I should have precised that I don't want to use directly the object webcontrol on the following web page http://www.vbwm.com/art_2000/masterie1_1.asp , a guy says that, using the "MS Internet control" library, it is possible to either use the webcontrol like you told me, or launch an Internet Explorer instance and that's what I need here... do you see?
-
Jan 26th, 2005, 09:10 AM
#4
Fanatic Member
Re: How to create an 'Internet Explorer' Object using Webbrowser control
You were close with your code. After the InternetExplorer object has been instantiated, it behaves the same way as the Web Browser control. Use this code, for example:
VB Code:
Dim objIE As InternetExplorer
Set objIE = New InternetExplorer
objIE.Visible = True
objIE.Navigate2 "http://www.vbforums.com"
Do While objIE.Busy = True
DoEvents
Loop
MsgBox objIE.Document.URL
Set objIE = Nothing
Author for Visual Basic Web Magazine
-
Jan 26th, 2005, 09:27 AM
#5
Frenzied Member
Re: How to create an 'Internet Explorer' Object using Webbrowser control
TheVader: What referenes would you need to set to use your code?
Other than the WebBrowser, are there any other controls that would need to be added to the form?
Beantown Boy
Please use [highlight=vb]your code goes in here[/highlight] tags when posting code.
When you have received an answer to your question, please mark it as resolved using the Thread Tools menu.
-
Jan 26th, 2005, 09:28 AM
#6
Thread Starter
Junior Member
Re: How to create an 'Internet Explorer' Object using Webbrowser control
Thx for your answer!
In fact, I've done it using the following code because when I use yours, I get an error message "Type is not defined" everytime I use "As InternetExplorer"... do you know why?
Dim MyBrowser
Set MyBrowser = CreateObject("InternetExplorer.application")
MyBrowser.AddressBar = False
MyBrowser.MenuBar = False
MyBrowser.Navigate ("http://www.yahoo.fr")
MyBrowser.Visible = True
-
Jan 26th, 2005, 09:35 AM
#7
Frenzied Member
Re: How to create an 'Internet Explorer' Object using Webbrowser control
 Originally Posted by siriusb
Thx for your answer!
In fact, I've done it using the following code because when I use yours, I get an error message "Type is not defined" everytime I use "As InternetExplorer"... do you know why?
Dim MyBrowser
Set MyBrowser = CreateObject("InternetExplorer.application")
MyBrowser.AddressBar = False
MyBrowser.MenuBar = False
MyBrowser.Navigate ("http://www.yahoo.fr")
MyBrowser.Visible = True
Yes, I know, but I don't know how to fix it, which was the purpose of my last post. You need to add a reference to your project that will enable your project to recognize the Type Internet Explorer. I just don't know what that reference is.
Beantown Boy
Please use [highlight=vb]your code goes in here[/highlight] tags when posting code.
When you have received an answer to your question, please mark it as resolved using the Thread Tools menu.
-
Jan 26th, 2005, 10:06 AM
#8
Fanatic Member
Re: How to create an 'Internet Explorer' Object using Webbrowser control
Sorry, forgot that. It's 'Microsoft Internet Controls'; no other components are necessary.
Author for Visual Basic Web Magazine
-
Jan 26th, 2005, 10:08 AM
#9
Frenzied Member
Re: How to create an 'Internet Explorer' Object using Webbrowser control
 Originally Posted by TheVader
Sorry, forgot that. It's 'Microsoft Internet Controls'; no other components are necessary. 
Ok. So all I would need is the component, no reference, correct?
Beantown Boy
Please use [highlight=vb]your code goes in here[/highlight] tags when posting code.
When you have received an answer to your question, please mark it as resolved using the Thread Tools menu.
-
Jan 26th, 2005, 10:10 AM
#10
Thread Starter
Junior Member
Re: How to create an 'Internet Explorer' Object using Webbrowser control
I've added the "MS Internet Control" library and I still have problems:
Error code 430
" the class doesn't manage Automation or interface" (I've translated from french)
I've just done a copy and paste of your code in the load form + added the library, is there something else to do?
==================================
Private Sub Form_Load()
Set objIE = New InternetExplorer
objIE.Visible = True
objIE.Navigate2 "http://www.vbforums.com"
Do While objIE.Busy = True
DoEvents
Loop
MsgBox objIE.Document.URL
Set objIE = Nothing
End Sub
-
Jan 26th, 2005, 10:14 AM
#11
Frenzied Member
Re: How to create an 'Internet Explorer' Object using Webbrowser control
Yep. The same thing happened when I tried it?
Beantown Boy
Please use [highlight=vb]your code goes in here[/highlight] tags when posting code.
When you have received an answer to your question, please mark it as resolved using the Thread Tools menu.
-
Jan 26th, 2005, 10:33 AM
#12
-
Jan 26th, 2005, 10:41 AM
#13
Thread Starter
Junior Member
Re: How to create an 'Internet Explorer' Object using Webbrowser control
Ok got it! I've added "MS Internet COntrols" as a component and not as a reference! It works fine now! thx a million, that's very nice helping us on this!
Have a nice day
-
Jan 26th, 2005, 10:52 AM
#14
Frenzied Member
Re: How to create an 'Internet Explorer' Object using Webbrowser control
 Originally Posted by siriusb
Ok got it! I've added "MS Internet COntrols" as a component and not as a reference! It works fine now! thx a million, that's very nice helping us on this!
Have a nice day
Yep. Me too. I had it added as a component. Once I added it as a reference, it worked like a champ. Thanks TheVader!!
Beantown Boy
Please use [highlight=vb]your code goes in here[/highlight] tags when posting code.
When you have received an answer to your question, please mark it as resolved using the Thread Tools menu.
-
Jan 26th, 2005, 11:38 AM
#15
Fanatic Member
Re: How to create an 'Internet Explorer' Object using Webbrowser control
You're welcome. For more info on using IE/WB, read the articles in my sig.
Author for Visual Basic Web Magazine
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|