473,671 Members | 2,557 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

WebBrowser / My.Resources question

Can I call a file (*.html) within My.Resources to show-up in my
WebBrowser control? If so, please provide a sample code or a link.
Thanks in advance for your help.

William Cruz

*** Sent via Developersdex http://www.developersdex.com ***
Mar 28 '07 #1
3 4050
This is what I am doing and it gives me an error:

WebBrowser1.Nav igate(My.Resour ces.Software_Li cense_Agreement )
Error:
"Error HRESULT E_FAIL has been returned from a call to a COM component."
William

*** Sent via Developersdex http://www.developersdex.com ***
Mar 28 '07 #2
You should load the HTML content directly into the webbrowser and not trying
to load from a location.

Here is a code to load dynamicaly the HTML into the webbrowser (You will
have to change the PageForText to your control name or if this code is
within the browser itself, Me).

Private Sub LoadContent(ByV al HTML As String)
' ensure that the document is loaded, otherwise the next line
fails...
If PageForText.Doc ument Is Nothing Then
PageForText.Nav igate2("about:b lank")
' get a reference to the document...
Dim clsDocument As mshtml.HTMLDocu ment = CType(PageForTe xt.Document,
mshtml.HTMLDocu ment)
' initiailize the document using the IPersistStreamI nit COM
interface...
DirectCast(clsD ocument, IPersistStreamI nit).InitNew()
' Marshal the content into a interop stream...
Dim ptrValue As IntPtr =
System.Runtime. InteropServices .Marshal.String ToHGlobalAuto(H TML)
Dim clsStream As System.Runtime. InteropServices .UCOMIStream =
Nothing
CreateStreamOnH Global(ptrValue , True, clsStream)
' load the content into the browser..
DirectCast(clsD ocument, IPersistStreamI nit).Load(clsSt ream)
End Sub
Jonathan Boivin
---
jo************@ cints.net | http://www.cints.net
"William Cruz" <wc*****@msn.co ma écrit dans le message de news:
On************* *@TK2MSFTNGP03. phx.gbl...
This is what I am doing and it gives me an error:

WebBrowser1.Nav igate(My.Resour ces.Software_Li cense_Agreement )
Error:
"Error HRESULT E_FAIL has been returned from a call to a COM component."
William

*** Sent via Developersdex http://www.developersdex.com ***

Mar 28 '07 #3
You will need these too .. (Let me know if something is missing)

Public Enum HRESULT
S_OK = 0
S_FALSE = 1
E_NOTIMPL = &H80004001
E_INVALIDARG = &H80070057
E_NOINTERFACE = &H80004002
E_FAIL = &H80004005
E_UNEXPECTED = &H8000FFFF
End Enum

<ComVisible(Tru e), ComImport(),
Guid("7FD52380-4E07-101B-AE2D-08002B2EC713"),
InterfaceTypeAt tribute(ComInte rfaceType.Inter faceIsIUnknown) _
Public Interface IPersistStreamI nit : Inherits IPersist
Shadows Sub GetClassID(ByRe f pClassID As Guid)
<PreserveSig()F unction IsDirty() As Integer
<PreserveSig()F unction Load(ByVal pstm As UCOMIStream) As HRESULT
<PreserveSig()F unction Save(ByVal pstm As UCOMIStream,
<MarshalAs(Unma nagedType.Bool) ByVal fClearDirty As Boolean) As HRESULT
<PreserveSig()F unction GetSizeMax(<InA ttribute(), Out(), _
MarshalAs(Unman agedType.U8)ByR ef pcbSize As Long) As HRESULT
<PreserveSig()F unction InitNew() As HRESULT
End Interface

<ComVisible(Tru e), ComImport(),
Guid("0000010c-0000-0000-C000-000000000046"),
InterfaceTypeAt tribute(ComInte rfaceType.Inter faceIsIUnknown) _
Public Interface IPersist
Sub GetClassID(ByRe f pClassID As Guid)
End Interface

Declare Function CreateStreamOnH Global Lib "ole32" (ByVal hGlobal As
IntPtr, ByVal fDeleteOnReleas e As Boolean, ByRef ppstm As UCOMIStream) As
Long
Jonathan Boivin
---
jo************@ cints.net | http://www.cints.net
"William Cruz" <wc*****@msn.co ma écrit dans le message de news:
eh************* @TK2MSFTNGP04.p hx.gbl...
Can I call a file (*.html) within My.Resources to show-up in my
WebBrowser control? If so, please provide a sample code or a link.
Thanks in advance for your help.

William Cruz

*** Sent via Developersdex http://www.developersdex.com ***

Mar 28 '07 #4

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

Similar topics

2
1841
by: frederik12 | last post by:
Hi all, Today I downloaded and installed VS 2005 C# Express Edition (.NET framework 2.0). I'm very pleased about this new product. In my current application I'm using the WebBrowser control in a child form. Two questions: 1) Does the user need IE to get this control working? 2) I cancel the closing of the child form in it's FormClosing event and
9
3802
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
1
2867
by: UJ | last post by:
How can I get rid of the scroll bars when I use a WebBrowser control? If the page/object I'm trying to display is to big - tough! I don't want the scroll bars. Thanks. Jeff.
19
2356
by: Blair P. Houghton | last post by:
I'm just learning Python, so bear with. I was messing around with the webbrowser module and decided it was pretty cool to have the browser open a URL from within a python script, so I wrote a short script to open a local file the same way, using the script file as an example target: # browser-test.py import webbrowser import sys
0
3569
by: Andy Bates | last post by:
Hi - This issue seems to have been kicking around since the dawn of time and no one appears to have come up with an answer. In short the MHT/MSHTML provides a method of archiving an HTML page into a single MIME encoded file that specifies all of the resources for a page in a single file. This makes a lot of sense as if you could pass one of these to the
0
5559
by: gunimpi | last post by:
http://www.vbforums.com/showthread.php?p=2745431#post2745431 ******************************************************** VB6 OR VBA & Webbrowser DOM Tiny $50 Mini Project Programmer help wanted ******************************************************** For this teeny job, please refer to: http://feeds.reddit.com/feed/8fu/?o=25
1
2944
by: alexander.stuckenholz | last post by:
Hello, is it possible to hook into the WebBrowser control, so that I can influence the way the control loads data (like images, css-files, ...) from web-servers? I would like to decrypt resources before they are parsed. Best regards,
6
6480
by: LEM | last post by:
Hi, I use a Webbrowser component to display a page that has been generate dynamically from my C# program. This page contains some images that are displayed using HTML code like this: <img src="person.gif"> person.gif is an image that is located in my bin folder.
17
7953
by: Cesar | last post by:
Hello people. I'm having a Winform app that contains a webbrowser control that keeps navigating from one page to another permanentrly to make some tests. The problem I'm having is that after a while, the application is using more than 100 or 150 Mb in RAM, and if I let it continue, it can leave the system without memory. I've been watching in some pages that other people has the same problem with this control when keep navigating for a...
0
8483
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
8402
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8927
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...
1
8605
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
7445
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...
0
4227
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
4416
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
2062
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
2
1816
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.