473,225 Members | 1,247 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,225 software developers and data experts.

Difference between vs2005 WebBrowser and AxWebBrowser components?

I'm looking to user a web browser component in VS2005.

I like the functionality in the AXWebBrowser component (from ActiveX
controls page) that allows me to do this:

mshtml.HTMLDocument doc;

doc = (mshtml.HTMLDocument)this.SecureWebBrowser.Documen t;

mshtml.HTMLButtonElement ButtonTest =
(mshtml.HTMLButtonElement)doc.all.item("ctl00$Cent erContent$ctl09$SignUp",
null);

ButtonTest.disabled = true;
Is this possible with the WebBrowser component that I can drop onto my
WinForm in VS2005 - I do not see that capability exposed - what are the
advances/disadvantages of each?

TIA!

Jan 16 '06 #1
6 11223
This should be possible. The WebBrowser control is basically the active
X wrapper, with some extra code to make the interop easier.

There are new elements defined in the System.Windows.Forms namespace
which represent the HTML elements. However, if you want, you should be able
to get at the original objects (through a cast or a property on the object)
and cast to the interfaces exposed through a reference to MSHTML.tlb.

Hope this helps.
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com

"ESmith" <el**********@hotmail.com> wrote in message
news:%2****************@tk2msftngp13.phx.gbl...
I'm looking to user a web browser component in VS2005.

I like the functionality in the AXWebBrowser component (from ActiveX
controls page) that allows me to do this:

mshtml.HTMLDocument doc;

doc = (mshtml.HTMLDocument)this.SecureWebBrowser.Documen t;

mshtml.HTMLButtonElement ButtonTest =
(mshtml.HTMLButtonElement)doc.all.item("ctl00$Cent erContent$ctl09$SignUp",
null);

ButtonTest.disabled = true;
Is this possible with the WebBrowser component that I can drop onto my
WinForm in VS2005 - I do not see that capability exposed - what are the
advances/disadvantages of each?

TIA!

Jan 16 '06 #2
"ESmith" <el**********@hotmail.com> wrote in message
news:%2****************@tk2msftngp13.phx.gbl...
I like the functionality in the AXWebBrowser component (from ActiveX
controls page) that allows me to do this:

mshtml.HTMLDocument doc;

doc = (mshtml.HTMLDocument)this.SecureWebBrowser.Documen t; Is this possible with the WebBrowser component that I can drop onto my
WinForm in VS2005 - I do not see that capability exposed - what are the
advances/disadvantages of each?


AxWebBrowser is an automatically generated wrapper, whereas WebBrowser is
manually customized for .NET. The WebBrowser control has more convenient
methods, such as loading and reading HTML as a string, and should be better
behaved - some people have strange issues with the AxWebBrowser especially
when nested within panels etc.

The snag as you say is that WebBrowser doesn't expose anything like the full
functionality of ShDocVw. However, you can get a reference to the underlying
ActiveX control via the ActiveXInstance property. See here for an example of
when this is necessary:

http://www.itwriting.com/blog/?postid=273

Overall I'd be inclined to use WebBrowser over the AxWebBrowser; or make an
even better wrapper of your own :-)

Tim
Read my tech blog:
http://www.itwriting.com/blog

Jan 16 '06 #3
Eliana,
Is this possible with the WebBrowser component that I can drop onto my
WinForm in VS2005 - I do not see that capability exposed - what are the
advances/disadvantages of each?


For simple browser programming, the 2005 WB is MUCH easier to use, but its
power is limited. If you want/need full control, you'll have to wrap it
yourself. The primary functionality that I've found missing in WB 2005 is
frame/iframe support. The control abstracts browsing to the degree that it
hides the fact that navigation events fire for each frame on the page. For
advanced WB programming, you must be aware of this and have control of it.
--
Colin Neller
http://www.colinneller.com/blog

Jan 16 '06 #4
My 0.02 worth...

I've just had to refactor a pile of code that used the AxWebBrowser version
(now uses WebBrowser) because I was getting obscure versioning issues on
some computers (casting complaints to/from mshtml types) - presumably
something to do with the version on the build machine. The WebBrowser
control (which presumably uses AxWebBrowser underneath) didn't appear to
have any such difficulty.

Of course, it helps that my requirements were fairly simple ;-p

Marc
Jan 17 '06 #5
Thanks to everyone for there replies!

P.S.

Marc, given the value of the Pound, looks like your opinion is carrying
more weight :-)

"Marc Gravell" <mg******@rm.com> wrote in message
news:Oh**************@TK2MSFTNGP11.phx.gbl...
My 0.02 worth...

I've just had to refactor a pile of code that used the AxWebBrowser
version (now uses WebBrowser) because I was getting obscure versioning
issues on some computers (casting complaints to/from mshtml types) -
presumably something to do with the version on the build machine. The
WebBrowser control (which presumably uses AxWebBrowser underneath) didn't
appear to have any such difficulty.

Of course, it helps that my requirements were fairly simple ;-p

Marc

Jan 17 '06 #6
I'm a .NET noob, so forgive me if this is obvious:

Can anyone give me a hint about how to hook up events from the WebBrower?

The following lets me get the IWebBrowser2 interface:
SHDocVw.IWebBrowser2 pWeb = (SHDocVw.IWebBrowser2)webBrowser1.ActiveXInstance;

However, I can't figure out how to go from that to the delegate:
SHDocVw.DWebBrowserEvents2_BeforeNavigate2EventHan dler

I know I can reach down and get the IConnectionPointContainer, etc and I
assume I could maybe wire it up myself, but that seems like the hard way to
go about it.

Thanks
Doug
"Tim Anderson" wrote:
"ESmith" <el**********@hotmail.com> wrote in message
news:%2****************@tk2msftngp13.phx.gbl...
I like the functionality in the AXWebBrowser component (from ActiveX
controls page) that allows me to do this:

mshtml.HTMLDocument doc;

doc = (mshtml.HTMLDocument)this.SecureWebBrowser.Documen t;

Is this possible with the WebBrowser component that I can drop onto my
WinForm in VS2005 - I do not see that capability exposed - what are the
advances/disadvantages of each?


AxWebBrowser is an automatically generated wrapper, whereas WebBrowser is
manually customized for .NET. The WebBrowser control has more convenient
methods, such as loading and reading HTML as a string, and should be better
behaved - some people have strange issues with the AxWebBrowser especially
when nested within panels etc.

The snag as you say is that WebBrowser doesn't expose anything like the full
functionality of ShDocVw. However, you can get a reference to the underlying
ActiveX control via the ActiveXInstance property. See here for an example of
when this is necessary:

http://www.itwriting.com/blog/?postid=273

Overall I'd be inclined to use WebBrowser over the AxWebBrowser; or make an
even better wrapper of your own :-)

Tim
Read my tech blog:
http://www.itwriting.com/blog

Mar 8 '06 #7

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

10
by: Richard Steele | last post by:
Can anyone help me I am developing an application runs on a PC (client) only. For graphical reasons it was decided that the content would be displayed in a Browser that is embedded in a Windows...
1
by: Adam Barker | last post by:
Hi guys, Noticed something strange and wondered if anyone had come across this. When using the WebBrowser control, if I in any way access the webBrowser1.Document object, I can no long type...
9
by: ASP .NET Newbie | last post by:
How can I run a WebBrowser control using ASP.NET/VB.NET? I know I can use the WebClient to get the page data, but I need to be able to use the WebBrowser (AxWebBrowser)? Thanks, Chad
0
by: Arthur Dent | last post by:
Hello all.... ive written a component which shows up fine in the toolbox for WinForm projects, but doesnt show up for WebForms. I found a post that said something about the...
0
by: ESmith | last post by:
In the previous WebBrowser component, I could get events (such as, WindowClosing) and act upon those event. I've tried getting the underlying ActiveX control and wiring up an event, but it...
0
by: Dean Slindee | last post by:
VS2005 WebBrowser control: I would like to be able to set the .url property of this control in vb code (not in the property page), but get a syntax error. How to do? WebBrowser1.Url =...
6
by: Dave Booker | last post by:
It appears that I cannot correctly install the AxWebBrowser in VS2005. I can instantiate an "AxWebBrowser browser" and refer to its members, properties, and methods. I'm having trouble with the...
11
by: Anil Gupte | last post by:
....and how do I insert one into my form? I used in VB 6.0 last, but cannot figure out where it is in .Net Thanx, -- Anil Gupte www.keeninc.net www.icinema.com
3
by: =?Utf-8?B?R2F1cmF2?= | last post by:
I am using the AxSHDocVw.AxWebBrowser control (named PreviewBrowser) in my C# app to load a pdf file: PreviewBrowser.Navigate(strPDF ,ref objNull,ref objNull,ref objNull,ref objNull); These PDF...
1
isladogs
by: isladogs | last post by:
The next online meeting of the Access Europe User Group will be on Wednesday 6 Dec 2023 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, Mike...
0
by: VivesProcSPL | last post by:
Obviously, one of the original purposes of SQL is to make data query processing easy. The language uses many English-like terms and syntax in an effort to make it easy to learn, particularly for...
3
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 3 Jan 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). For other local times, please check World Time Buddy In...
0
by: jianzs | last post by:
Introduction Cloud-native applications are conventionally identified as those designed and nurtured on cloud infrastructure. Such applications, rooted in cloud technologies, skillfully benefit from...
0
by: abbasky | last post by:
### Vandf component communication method one: data sharing ​ Vandf components can achieve data exchange through data sharing, state sharing, events, and other methods. Vandf's data exchange method...
2
by: jimatqsi | last post by:
The boss wants the word "CONFIDENTIAL" overlaying certain reports. He wants it large, slanted across the page, on every page, very light gray, outlined letters, not block letters. I thought Word Art...
0
by: stefan129 | last post by:
Hey forum members, I'm exploring options for SSL certificates for multiple domains. Has anyone had experience with multi-domain SSL certificates? Any recommendations on reliable providers or specific...
0
Git
by: egorbl4 | last post by:
Скачал я git, хотел начать настройку, а там вылезло вот это Что это? Что мне с этим делать? ...
0
by: MeoLessi9 | last post by:
I have VirtualBox installed on Windows 11 and now I would like to install Kali on a virtual machine. However, on the official website, I see two options: "Installer images" and "Virtual machines"....

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.