472,993 Members | 3,309 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

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

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 4025
This is what I am doing and it gives me an error:

WebBrowser1.Navigate(My.Resources.Software_License _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(ByVal HTML As String)
' ensure that the document is loaded, otherwise the next line
fails...
If PageForText.Document Is Nothing Then
PageForText.Navigate2("about:blank")
' get a reference to the document...
Dim clsDocument As mshtml.HTMLDocument = CType(PageForText.Document,
mshtml.HTMLDocument)
' initiailize the document using the IPersistStreamInit COM
interface...
DirectCast(clsDocument, IPersistStreamInit).InitNew()
' Marshal the content into a interop stream...
Dim ptrValue As IntPtr =
System.Runtime.InteropServices.Marshal.StringToHGl obalAuto(HTML)
Dim clsStream As System.Runtime.InteropServices.UCOMIStream =
Nothing
CreateStreamOnHGlobal(ptrValue, True, clsStream)
' load the content into the browser..
DirectCast(clsDocument, IPersistStreamInit).Load(clsStream)
End Sub
Jonathan Boivin
---
jo************@cints.net | http://www.cints.net
"William Cruz" <wc*****@msn.coma écrit dans le message de news:
On**************@TK2MSFTNGP03.phx.gbl...
This is what I am doing and it gives me an error:

WebBrowser1.Navigate(My.Resources.Software_License _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(True), ComImport(),
Guid("7FD52380-4E07-101B-AE2D-08002B2EC713"),
InterfaceTypeAttribute(ComInterfaceType.InterfaceI sIUnknown)_
Public Interface IPersistStreamInit : Inherits IPersist
Shadows Sub GetClassID(ByRef pClassID As Guid)
<PreserveSig()Function IsDirty() As Integer
<PreserveSig()Function Load(ByVal pstm As UCOMIStream) As HRESULT
<PreserveSig()Function Save(ByVal pstm As UCOMIStream,
<MarshalAs(UnmanagedType.Bool)ByVal fClearDirty As Boolean) As HRESULT
<PreserveSig()Function GetSizeMax(<InAttribute(), Out(), _
MarshalAs(UnmanagedType.U8)ByRef pcbSize As Long) As HRESULT
<PreserveSig()Function InitNew() As HRESULT
End Interface

<ComVisible(True), ComImport(),
Guid("0000010c-0000-0000-C000-000000000046"),
InterfaceTypeAttribute(ComInterfaceType.InterfaceI sIUnknown)_
Public Interface IPersist
Sub GetClassID(ByRef pClassID As Guid)
End Interface

Declare Function CreateStreamOnHGlobal Lib "ole32" (ByVal hGlobal As
IntPtr, ByVal fDeleteOnRelease As Boolean, ByRef ppstm As UCOMIStream) As
Long
Jonathan Boivin
---
jo************@cints.net | http://www.cints.net
"William Cruz" <wc*****@msn.coma écrit dans le message de news:
eh*************@TK2MSFTNGP04.phx.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
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...
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
1
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
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...
0
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...
0
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...
1
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...
6
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...
17
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...
0
by: lllomh | last post by:
Define the method first this.state = { buttonBackgroundColor: 'green', isBlinking: false, // A new status is added to identify whether the button is blinking or not } autoStart=()=>{
2
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 4 Oct 2023 starting at 18:00 UK time (6PM UTC+1) and finishing at about 19:15 (7.15PM) The start time is equivalent to 19:00 (7PM) in Central...
4
NeoPa
by: NeoPa | last post by:
Hello everyone. I find myself stuck trying to find the VBA way to get Access to create a PDF of the currently-selected (and open) object (Form or Report). I know it can be done by selecting :...
3
NeoPa
by: NeoPa | last post by:
Introduction For this article I'll be using a very simple database which has Form (clsForm) & Report (clsReport) classes that simply handle making the calling Form invisible until the Form, or all...
1
by: Teri B | last post by:
Hi, I have created a sub-form Roles. In my course form the user selects the roles assigned to the course. 0ne-to-many. One course many roles. Then I created a report based on the Course form and...
3
by: nia12 | last post by:
Hi there, I am very new to Access so apologies if any of this is obvious/not clear. I am creating a data collection tool for health care employees to complete. It consists of a number of...
0
NeoPa
by: NeoPa | last post by:
Introduction For this article I'll be focusing on the Report (clsReport) class. This simply handles making the calling Form invisible until all of the Reports opened by it have been closed, when it...
4
by: GKJR | last post by:
Does anyone have a recommendation to build a standalone application to replace an Access database? I have my bookkeeping software I developed in Access that I would like to make available to other...
3
SueHopson
by: SueHopson | last post by:
Hi All, I'm trying to create a single code (run off a button that calls the Private Sub) for our parts list report that will allow the user to filter by either/both PartVendor and PartType. On...

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.