Web Browser Control

V

VJ

I am using the web browser control.., I would like to add the control at
runtime...

I was adding the web browser control at desgin time. Now I decided to add
the control at run time so I removed the control from the form and also the
refrences to AxSHDocVw and SHDocVw, then I added the following statments

Dim axwbOfficeDocEditor As New AxSHDocVw.AxWebBrowser
Me.Controls.Add(axwbOfficeDocEditor)
axwbOfficeDocEditor.Dock = DockStyle.Fill

I get the following error,
Type 'AxSHDocVw.AxWebBrowser' is not defined.

What am I missing?? Can't I add the webbrowser control at run-time?

VJ
 
G

Guest

Hi VJ.
The error is obvious: there isn't, in your code, a reference to the .dll
containing the "web browser" object.
You can simply add the "Web Browser" component to your toolbox. From the
main menu:
Tools->Add/Remove Toolbox Items->[tab]COM Components
and choose "Microsoft Web Browser" from the list. Then confirm and you'll
have a
browser component in your toolbox. Just drag and drop into your application.

Bye
Francesco
http://www.chantive.it/simplog/
 
H

Herfried K. Wagner [MVP]

* "VJ said:
I am using the web browser control.., I would like to add the control at
runtime...

I was adding the web browser control at desgin time. Now I decided to add
the control at run time so I removed the control from the form and also the
refrences to AxSHDocVw and SHDocVw, then I added the following statments

Dim axwbOfficeDocEditor As New AxSHDocVw.AxWebBrowser
Me.Controls.Add(axwbOfficeDocEditor)
axwbOfficeDocEditor.Dock = DockStyle.Fill

I get the following error,
Type 'AxSHDocVw.AxWebBrowser' is not defined.

What am I missing?? Can't I add the webbrowser control at run-time?

You can, after you completed these steps:

311303 WebOCHostVB.exe Hosts the WebBrowser Control in Visual Basic .NET
<URL:http://support.microsoft.com/?id=311303>
 
S

scorpion53061

yeah I saw that.

There is a guy named Balena that wrote a book that pretty much taught me
every thing I know about vb.net (save the sarcastic remark I just walked
into there :))

Somebody I would like to meet that guy. You talk about somebody who knows it
"all".
 
V

VJ

Hi..

I am not sure this link helps me... If I remove the 2 refernces "AxSHDocVw
and SHDocVw" this project aslo complains the same as mine..

The problem is if I have these 2 references.. they take up like large memory
when project loads...

VJ
 
G

Guest

Hi VJ, can you explain to us what's the real problem?
Are you able to add Web Browser as component in the Toolbox?
Why do you remove the SHDocVw referencess from the solution? You need them!
Regarding the memory: yes, it's possible, because the Web Browser component
is just an "Internet Explorer" hosted in your project.
--
Francesco

VJ said:
Hi..

I am not sure this link helps me... If I remove the 2 refernces "AxSHDocVw
and SHDocVw" this project aslo complains the same as mine..

The problem is if I have these 2 references.. they take up like large memory
when project loads...

VJ

also
 
C

Cor Ligthert

Hi VJ,

I find it curious that Herfried says you can do it without pulling it to
your desktop, I thought that neither Charles Law and neither me did ever
succeed in it, however maybe Charles did now already and than you will see a
message soon from him, which he always has done when he sees this kind of
messages.

Cor
 
C

Charles Law

Hi VJ

Further to the other answers, you will have problems if you remove the two
references AxShDocVw and ShDocVw from your application. The WebBrowser
control needs them, so they must be present.

I am surprised that you say they take a lot of memory when the application
starts up. They should not be loaded until they are required. Try the
following experiment:

Create a new Windows application and drag a WebBrowser control onto the
default form. This will add the two dlls as references. Now delete the
WebBrowser control and run the application in the debugger.

Look at the output window and you will see that the dlls are not loaded.

Now, add the control again, but this time go to the InitializeComponent
method and move all the code relating to the creation of the WebBrowser
control into a function LoadBrowser() and place a button on the form that
calls this new function. Run the application again and once more the dlls
are not loaded. Click the button and the dlls are loaded, and the WebBrowser
control appears on the form.

HTH

Charles
 
V

VJ

I am showing a memory occupancy of 20 MB of our application... I am not sure
about like certain parts.. There is a application which complied as DLL and
called from the Main MDI. I guess the Web Browser control is still added in
design mode in that application. Maybe that reference is getting bottled
up.. Could it be?

I will trim all the parts of the web browser control to runtime and then
give it a shot.. maybe it will come down. I do see the point.. of DLL in
debug window... I will check that out..

Thanks for all your help..
VJ
 
C

Cor Ligthert

Hi VJ,

Do you have maybe the webbrowser in a special class while you have not used
the component model.component as base class for that?

Or when you did, do not dispose that class?

Cor
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top