473,385 Members | 1,356 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,385 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 4038
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: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 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 former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

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.