473,785 Members | 2,400 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

VB.NET 2005 Express WebBrowser Control

I recently (within 30 days) downloaded and installed VB 2005 Express.
I like it a whole lot... but:

I have been trying to work with the WebBrowser control to display a
small amount of help text for my application and though I've finally
made it work, it seems a bit quirky, so perhaps that's the control
being quirky or perhaps there is something I don't understand.

1) I could not figure out a way to make the webbrowser object display
a page of HTML from a file on the local disk in the same directory as
the application. I tried setting the Url property to file:///help.htm
and file://help.htm and neither worked. help.htm was in the
applications directory. -- Is that were it should exist? I would
prefer to use the control with a local file, but read on...

2) I then found that I could stuff text into the
WebBrowser.Docu mentText property and alas - the page was displayed
(that is, the page of text that I stuffed into the property, not the
page as described by the Url property).

3) I cleaned up the object by removing the text in the Url property -
this broke it and the WebBrowser object displayed nothing, even though
I stuffed the DocumentText property.

4) I tried setting the Url property to about:blank, still the object
displayed nothing.

5) Then I found that as long as there is something like http://x in
the Url propertly, the webbrowserobjec t will display the HTML I stuff
into the DocumentText property. This is true, even if the page
referred to by the Url property does not exist. -- so why doesn't
using about:blank work?

Also, the AllowNavigation property must be set to true or this won't
work.

I've looked on various web forums and while I can see that others have
had a similar problem, I haven't seen any solution that makes sense or
simply declares the current object is buggy.

Help/advice/condolences greatly appreciated.
May 26 '07 #1
2 6360
On Sat, 26 May 2007 21:53:37 GMT, no*****@gte.net (Scott Gravenhorst)
staggered into the room, obviously drunk, and said:
>I recently (within 30 days) downloaded and installed VB 2005 Express.
I like it a whole lot... but:

I have been trying to work with the WebBrowser control to display a
small amount of help text for my application and though I've finally
made it work, it seems a bit quirky, so perhaps that's the control
being quirky or perhaps there is something I don't understand.

1) I could not figure out a way to make the webbrowser object display
a page of HTML from a file on the local disk in the same directory as
the application. I tried setting the Url property to file:///help.htm
and file://help.htm and neither worked. help.htm was in the
applications directory. -- Is that were it should exist? I would
prefer to use the control with a local file, but read on...

2) I then found that I could stuff text into the
WebBrowser.Doc umentText property and alas - the page was displayed
(that is, the page of text that I stuffed into the property, not the
page as described by the Url property).

3) I cleaned up the object by removing the text in the Url property -
this broke it and the WebBrowser object displayed nothing, even though
I stuffed the DocumentText property.

4) I tried setting the Url property to about:blank, still the object
displayed nothing.

5) Then I found that as long as there is something like http://x in
the Url propertly, the webbrowserobjec t will display the HTML I stuff
into the DocumentText property. This is true, even if the page
referred to by the Url property does not exist. -- so why doesn't
using about:blank work?

Also, the AllowNavigation property must be set to true or this won't
work.

I've looked on various web forums and while I can see that others have
had a similar problem, I haven't seen any solution that makes sense or
simply declares the current object is buggy.

Help/advice/condolences greatly appreciated.

WebBrowser1.Url = New System.Uri("fil e:///" & Application.Sta rtupPath
& "/help.html")

This works for me. Try it out, let me know if it helps any.

Ryan
May 26 '07 #2
On Sat, 26 May 2007 18:32:16 -0400, Yet Another One <me@here.com>
wrote:
>On Sat, 26 May 2007 21:53:37 GMT, no*****@gte.net (Scott Gravenhorst)
staggered into the room, obviously drunk, and said:
>>I recently (within 30 days) downloaded and installed VB 2005 Express.
I like it a whole lot... but:

I have been trying to work with the WebBrowser control to display a
small amount of help text for my application and though I've finally
made it work, it seems a bit quirky, so perhaps that's the control
being quirky or perhaps there is something I don't understand.

1) I could not figure out a way to make the webbrowser object display
a page of HTML from a file on the local disk in the same directory as
the application. I tried setting the Url property to file:///help.htm
and file://help.htm and neither worked. help.htm was in the
application s directory. -- Is that were it should exist? I would
prefer to use the control with a local file, but read on...

2) I then found that I could stuff text into the
WebBrowser.Do cumentText property and alas - the page was displayed
(that is, the page of text that I stuffed into the property, not the
page as described by the Url property).

3) I cleaned up the object by removing the text in the Url property -
this broke it and the WebBrowser object displayed nothing, even though
I stuffed the DocumentText property.

4) I tried setting the Url property to about:blank, still the object
displayed nothing.

5) Then I found that as long as there is something like http://x in
the Url propertly, the webbrowserobjec t will display the HTML I stuff
into the DocumentText property. This is true, even if the page
referred to by the Url property does not exist. -- so why doesn't
using about:blank work?

Also, the AllowNavigation property must be set to true or this won't
work.

I've looked on various web forums and while I can see that others have
had a similar problem, I haven't seen any solution that makes sense or
simply declares the current object is buggy.

Help/advice/condolences greatly appreciated.


WebBrowser1.Ur l = New System.Uri("fil e:///" & Application.Sta rtupPath
& "/help.html")

This works for me. Try it out, let me know if it helps any.

Ryan
Thank you Ryan, that does in fact work. I didn't realize I needed to
specify the startup directory - that makes sense, but out of
curiousity, I still would like to know why I can't leave the Url
property blank and simply stuff the DocumentText property and have the
object display the data... ?? It _will_ display the stuffed HTML if
I put anything basically legal in the Url property, regardless of
whether the page exists or not.

P.S., yes, I am having a beer, but no, I am not yet drunk... (c;
May 26 '07 #3

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

Similar topics

0
3480
by: Jim Hubbard | last post by:
How would I implement the IDispatch interface to handle the following in VB.Net <BEGIN> Controlling Download and Execution The WebBrowser Control gives you control over what it downloads, displays, and executes. To gain this control, you need to implement your host's IDispatch so it handles DISPID_AMBIENT_DLCONTROL. When the WebBrowser Control is instantiated, it will call your IDispatch::Invoke with this ID. Set pvarResult to a...
1
1507
by: thomasp | last post by:
Using VB2005 Beta 2. I have a form that uses a small webbrowser control to display information to the user. I need to have the webbrowser control scroll to a certain position for each of the other controls on the form. I had this working with a richtextbox, but needed to change to a webbrowser control. Thanks for any help you can provide. Thanks, Thomas
7
7539
by: Doe | last post by:
I've been trying this for months. Doesn't work. I've used the code in this article, http://support.microsoft.com/kb/311288/en-us, HOW TO: Invoke the Find, View Source, and Options Dialog Boxes for the WebBrowser Control from Visual Basic .NET. This code worked in VB.Net 2003 but not in VB.Net 2005. Specifically this doesn't work... (all code is from article)
2
5496
by: cweeks78681 | last post by:
I am porting some VB6 code that automates navigation through a web page by getting all the <a> tags into a collection and then calling the Click method on the appropriate one. How do I click a link in a web page using the WebBrowser control in VS 2005 C# Express and .NET 2.0?
1
6596
by: cweeks | last post by:
Prior to .NET 2.0 the WebBrowser control had a method Navigate2 that took in its second parameter a switch to disable reading the page from the local IE cache. I want to be able to do this in a VS 2005 C# Express app but I don't see anything in the Navigate signature that would let me do this. Is there some other mechanism for disabling the IE cache from within my app?
3
2354
by: cweeks | last post by:
I use the InvokeMember("Click") method of HtmlElement to click a button in a web page using the Webbrowser control that is new in VS 2005 C# Express. Now I need to be able to select a member of a list before clicking the button. Using InvokeMember("Click") on the HtmlElement does not cause that list item to be selected. How do I select that list item from C# the way a user would with the left mouse button?
1
3262
by: Marvinq | last post by:
I'm a newbie to asp.net, but I have been a programmer for years. I have a question that I'm hoping someone can give me a good answer for, I have been trying to set up a site remotely and I've been using the login control that comes with Visual Web Developer 2005 Express, this comes with SQL 2005 Express. The remote site is not a company computer, but basically a host that I'm paying for. When I deploy on this remote site and try to log...
10
2709
by: kimiraikkonen | last post by:
Visual C#.NET 2005 express has some issues, unlike VB.NET 2005 has none of them: The most annoying one is: For example if there's a coding error, it must be reported at the buttom of the screen in "error list" "REAL-TIME". At least, that was like that in VB.NET 2005 express. But in Visual C# .NET 2005 you won't be able to aware of coding errors till you press "play" build & run button.
4
1297
by: Gillard | last post by:
when i try to create a project from template i get an error like error : activex can t create object when i try to compile a sinple c++ project that i get from else where i get multiple error style windows.h not found , midl.exe not found ,................... not found what should i do to resolve this
0
9646
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10346
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10157
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
8982
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7504
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5386
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5514
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4055
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3658
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.