473,402 Members | 2,072 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,402 software developers and data experts.

saving the contents of axWebBrowser1 to a htm file ?

hi

how do i save the contents of a axWebBrowser1 to a htm file ?

i have a webpage loaded and would like to save it to my harddrive.

also how do i open the file from my harddrive to open in the
axWebBrowser1 box ?

Thanks MrXs

Nov 16 '05 #1
3 2764
Try this

1 .Define HTMLDocumentClass object

private mshtml.HTMLDocumentClass pHTMLDoc;

2. In the document complete event do this

private void myBrowser_DocumentComplete(object sender,
AxSHDocVw.DWebBrowserEvents2_DocumentCompleteEvent e)
{
pHTMLDoc= (HTMLDocumentClass)DesignBrowser.Document;
}

3. To save

pHTMLDoc.execCommand ("SaveAs", false, @"c:\test.html");

4. To open html page navigate browser

string htmlfile =@c:\test.hml";
object oEmpty = null;
object oUrl = htmlfile;

myBrowser.Navigate ( ref oUrl, ref oEmpty, ref oEmpty, ref oEmpty, ref
oEmpty );
--
Shak
(Houston)


"MrXs" <Mr******@hotmail-dot-com.no-spam.invalid> wrote in message
news:40**********@Usenet.com...
hi

how do i save the contents of a axWebBrowser1 to a htm file ?

i have a webpage loaded and would like to save it to my harddrive.

also how do i open the file from my harddrive to open in the
axWebBrowser1 box ?

Thanks MrXs

Nov 16 '05 #2
thanks shakir, that put me on the right track ;)

i used the followng code

private void buttonItem11_Click(object sender, System.EventArgs
e)
{
object oEmpty = null;
object oURL = "c:/test.htm";
axWebBrowser1.Navigate2(ref oURL, ref oEmpty, ref oEmpty,
ref oEmpty, ref oEmpty);
}

but i require opening a page i select that is saved to my hd ( browse
the file then select and load ) each time i will select a different
page / htm file to load so should i use the browse dialog ?

thanks :D

Nov 16 '05 #3
Yes, use the OpenfileDialog and receive the file name from user. Then pass
it to Navigate2 method.

--
Shak
(Houston)


"MrXs" <Mr******@hotmail-dot-com.no-spam.invalid> wrote in message
news:40********@Usenet.com...
thanks shakir, that put me on the right track ;)

i used the followng code

private void buttonItem11_Click(object sender, System.EventArgs
e)
{
object oEmpty = null;
object oURL = "c:/test.htm";
axWebBrowser1.Navigate2(ref oURL, ref oEmpty, ref oEmpty,
ref oEmpty, ref oEmpty);
}

but i require opening a page i select that is saved to my hd ( browse
the file then select and load ) each time i will select a different
page / htm file to load so should i use the browse dialog ?

thanks :D

Nov 16 '05 #4

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

Similar topics

3
by: Aviv Ben-Yosef | last post by:
Hello all. I've been wondering whether or not there's a way to start writing to an ofstream and then save it under a specific filename, or must it be done in the first hand with fstream::open ?...
6
by: Vijay | last post by:
I need to generate HTML files based on the some codes. One HTML file per code. I have the link (ex:http://123.234.345.456/WebPages/GetTestData.aspx?SomeCode=25), by passing the code as parameter I...
2
by: jhattersley | last post by:
Hi Folks, Wonder if you can help... All I'm trying to do is load a couple of simple HTML pages (in memory) into the WebBrowser control, one after the other. I don't seem to be able to clear...
4
by: dale zhang | last post by:
Hi, I am trying to save and read an image from MS Access DB based on the following article: http://www.vbdotnetheaven.com/Code/Sept2003/2175.asp Right now, I saved images without any...
3
by: jad101 | last post by:
I have an asp.net web page that: 1. Shows a message 2. Posts back (using javascript) 3. Reads contents of a file 4. response.write the contents of the file to the browser My issue is this: ...
3
by: David | last post by:
hi... i have webform *.aspx file, wich do some bd requests and generates (how it should) html file to show on client pc.. now... i want my web solution, this web form is part of this solution,...
3
by: vivicio047 | last post by:
i am writing a c prog in a Rich Text Box and want to save it. But saving the contents of the RTB also writes the font type,size and other details also as in an html file. please help me on how to...
2
by: Dean Richardson | last post by:
Hello, I am currently building a windows application in VB.NET. At the moment I have a word document saved locally which I open with the WebBrowser control. I cannot seem to save the changes...
0
by: Dean Richardson | last post by:
Hello, I am currently building a windows application in VB.NET. At the moment I have a word document saved locally which I open with the WebBrowser control. I cannot seem to save the...
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...
0
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,...
0
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...
0
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,...
0
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...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
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,...

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.