It can be a powerful thing to display dynamic HTML in your C# applications. It can give your applications a modern look and feel and can make displaying data in non-standard ways easy with some simple markup. We have the web browser ActiveX control that wraps up what we know as Internet Explorer. While I don't want to get into the in's and out's of using the web browser in your applications, I do want to demonstrate a few things that will make the use of the web browser easier so you can integrate it seamlessly into your applications.

Some common requests I see in regards to using the web browser control is the ability to set the HTML to display in the browser without writing it to a file and navigating to it, printing the contents of the browser, and other items related to manipulating it's contents. Let's take a quick look at those.

Setting the HTML without writing to a file

Many times when the web browser control is used, the HTML content that the developer wishes to display will be written to a text/html file and then Navigate is used to navigate to the file, such as the following:

The problem with that is, of course, that you need to write to a file. This brings in other possible issues such as ensuring you write the file to a location where the user has permissions to do so. A better route is to not write to a file at all. Instead, set the HTML directly in the browser. To accomplish this we need to get a reference to the browser's internal HTML document and manipulate it using the Document Object Model. We need to add a reference to the “Microsoft HTML Object Library” (mshtml) to get to the interfaces & classes that we will use to get to the document's DOM. Once you add the reference, you can get to the document and do whatever you want. However, in order to get to the document, you will have to navigate to about:blank before it can be accessed. If you do not first load or navigate to something then the document will be null. So first of all let's load about:blank to create a blank document.

Printing is only the beginning of what you can do here. Take a look at all the possible commands you can send via execCommand here. It really opens up what you can get to when you look at what you have available. I'll outline in another post how to disable the right-click menu of the browser (by default you'll get the standard IE right-click menu) as well as how to take this a step further in integrating the power of C# with dynamic HTML in your applications.

Comments

I've seen several methods for accomplishing this but I'm still looking for a way to include images in the rendered HTML without requiring them to be external files. I believe some web-based native applications (e.g. various Control Panel applets) use the res:// scheme to get the images from embedded resources within the .dll (or .cpl as the case may be), though to my knowledge this is not possible with a .NET assembly. I can think of two ways that might make this possible: -

1. Implement a new URL moniker that catches your own custom URL scheme (like "application://Company.Application.Resources/Image1") and somehow make it read the binary image data from your managed resource DLL and return it to the WebBrowser control as if it had just 'downloaded' it from a file on the hard disk or from the web. URL monikers look unbelievably complicated for a task that I consider should be trivial, so I'm naturally inclided to avoid this approach.

2. Subscribe to a WebBrowser event that is fired *before* it attempts to download the image via the URL monikers that will allow you to essentially implement an in-place URL moniker. I've looked and looked through the interfaces available and can't see any event that would allow this.

thanks for the demo, it helped my understanding alot. I was wondering if we can retrieve the html just as easy as the writeln method. how can we access the source? (i'll be comparing the current source to the original html string).

tks for the response with the innerHTML property. But i was wondering if i can fetch the entire source including all <html><head><body> tags and javascript functions. I've also tried the outerHTML property and it only returns the body.

I see what you are doing but what is this "mshtml" you are using. Where is all the COM implmentation behind it? I have to implement this myself very quickly so if you could respond quickly, I'd really appreciate it.

You may have already figured this out but you can get the whole document source including all <head><body> tags by using the following:
string source = ((mshtml.HTMLDocumentClass)(doc)).documentElement.innerHTML;

mshtml is implemented in a COM library that you will already have on your pc. Add a reference to the COM library named "Microsoft HTML Object Library". It will of course create the needed interop wrapper named mshtml.

hi all
i need to iterate through html source one by one using the web browser
for that i hav to call my own function which captures the data
can any one help me that how do i change the URL automatically and when that HTML is created so that i can get my function invoked ?

Hi,
I am using the webbrowser control in my application a bit differently-
I opened the url automatically in the webbrowser.
Then, I tried to print the page and the print dialog box opened through which I could print.
Let's say I want to automate the all process, meaning, after opening the html page I will activate the print button from the software (with no user involvement). I want to skip the print dialog box.
The command is : doc.execCommand("Print", true, 0);
How can I print without going through the print dialog box?

Hi Ryan,
Context : Invalid Cast Exception on casting IHTMLDocument to IDisplayServices Interface
I am working upon an application that happens to host MSHTML.I am developing a component that provides "spell check as u type" services.
I am having problem of "Invalid Cast Exception" . I will define the problem in the end. First the scenario is as follows,

Spell Checking Stretgy :

My stretegy as follows,

I send browser text to a Spell Checking Engin. raises MissSpelledFound event whenever it encountered a incorrectly typed word along with all indexing info (means where it can be located in original string).
Event Hanler that captures MiSpelledWordFound Event is as follows,

This method does its best, when I run it from any event which is not a Thread(Strictly saying this).
But Whenever a background spell checking thread that I code to provide "check spell as u type" services, I then find similar problems as Misha that is

Problem :
IHTMLDocument never typecast to IDisplay Services, this is the real trouble, I have not been able to cope with,
When it happens, no underlyining can be done using IDisplayServices. At leasst I could not do so.( I wish If somebody can get me out of this problem).

Hi All.,
i am using mshtml for retrievel of page. and this to do this i need to login to that page by passng user,password. this taks also i can do.and am able to display the page in webbroser control on my form.now my requirement is i need to scrap the page contents which includes sub pages. how to handle this with mshtml. any idea..

Using a browser based app makes it very much easier to aline both the requirements of 508 and of the various screen readers that are available in the market. For me the base default is Microsoft's accessibility reader that comes with their various OS's.

A browser based solution has tendency to be read in a more user friendly way, title tag, mouseover and alt tags etc, than a form based executable, which appears to require the user to give focus in order for the screen reader function.

To this end I am interested in your comments of 2/15/2005 and wether you have had the time to further your research.

Hi
How can i implement the same printing functionality in a web application where i cant use the webbrowser control . I actulay want to read some html content from the database and print it directly without any prompting.

While printing from the browser I've noticed that on certain OS it doesn't print when you invoke the print command on 2000 or XP with sp1. I've read that there might be a issue with the SHDocVw.dll. Is this the case or is there some other reason. Here is my function call. This call prints on most of my OS.

Seems like a minor obstacle, so I went around that lack of indexing and went to the trouble of using the HTMLFrameElement.item(ref ptrIndex) function to get the frame. That worked, but any time I attempt to access any property, a COM exception is thrown (devilishly hard to track down!!!):

"Marshalling Restriction: Excessively long string"

I haven't really seen any documentation on why this error comes about; I've even put in an unsafe code block and tried to marshall the return strings as different types of strings with no luck.

This whole indexer thing is simply weird, and the Marshaller problem even weirder!

Can anyone point me in the right direction to figure out how to "paint" (pixel by pixel) right on top of the surface of a web page loaded in IE? I'm talking about going beyond what is possible by adding elements to the DOM and just adding graphics right on top of the web page. Any ideas?

"The problem is I can't set the page/printer properties (i.e. orientation, margins, page size, copies, etc.) Any advise would be greatly appreciated."

The printer properties are the same as IE and are stored in the registry. The easiest way to deal with this is have your code check the values and set the values you want during installation or everytime your app is run.

Hi ,
I am trying to write an extension to IE,trying to tranlate the english text to indic script. I need to get the text as the user enters in a text area in a form and then convert it to unicode. how can i get the text or keyboard input. I thought of hooks but i dont want to use hooks because they need global resources and it gets messy.
thanks
chava

Is there a way to access the current browser that is open? I have a web app where I want to access the DOM but I am not using a activex control for browsing. Just the default browser that it pops up in when I run the app. How do I access that?

You must execute the code of BeforeNavigate2 event on the NavigateComplete2 event. Before, you must capture the url on the BeforeNavigate2 event, and, for example, write this url in a property to can access to the url in NavigateComplete2 event.

I am using this AXWebBrowser control in a winform application, but i experienced that the html page is not accepting any keyboard input for any text boxes in there. Can you please tell me where i have gone wrong or how to fix this issue. Thanks for your help.

I'm looking at writing a c# app to drive a web application I need to test. I have the browser control setup and have some rudementary navigation happening, but I've run into problems.

The html of the pages I'm navigating isn't very good and many of the tags don't have a name or id attribute, making them tough to get at in my app. I've been able to get around this using the innerHTML and innerText properties to match on known values, but I just hit a new snag.

I guess the method of accessing the DOM breaks down if it hits a nested table. I was having trouble matching a known innerText value so I had the app spit out all of the tags it was examining. It gets to a table tag nested within another table tag and stops processing tags.

Anyone have any ideas, or links specifically abount navigating the DOM? thanks in advance!

(I know VB.NET) ... but what the hell...most of the problems (questions presented here) can be solved by searching google, and looking at the MSDN web site. I found that the Microsoft .NET (VS 2003) way of wrapping this control did not work properly as there is a bug ... (handle click events get un-handled after navigating using the control) after much searching a Microsoft person on a non Microsoft web site agreed and said go back the old VB6 wapper method (which was posted on the VB Xtream forum).

I hope this helps someone who like me has had to rewire there app due to this interesting control.

I have placed a WebBrowser in a Form(C# language) and navigated to a website. Then i have an another application which sends keystrokes to the form containing WebBrowser.
if we use
SendKeys.Send({A}); //not working
////////
SendKeys.Send({TAB}); //WORKING
SendKeys.Send(+{TAB});
SendKeys.Send({A});
my email is :arun5_appu@yahoo.com

I need to print the contains on my webbroser, i have 12 lines, and when i print, the document had 60 lines that means 48 blank lines. I don't known how to size the numbers of lines to print. This is my command:
axWebBrowser1.ExecWB(SHDocVw.OLECMDID.OLECMDID_PRINT, SHDocVw.OLECMDEXECOPT.OLECMDEXECOPT_DONTPROMPTUSER, ref empty, ref empty);

I have placed a WebBrowser in a Form(C# language) and navigated to a website. Then i have an another application which sends keystrokes to the form containing WebBrowser.
if we use
SendKeys.Send({A}); //not working
////////
SendKeys.Send({TAB}); //WORKING
SendKeys.Send(+{TAB});
SendKeys.Send({A});
my email is :arun5_appu@yahoo.com
Can anybody help me in this matter(ie why WebBrowser not receiving keystrokes)

i have embedded a webbrowser into a panel in C# project but getting a error that states that it could not find respective resource filename in the assembly file.As i am adding the webbrowser in panel so i m passing form name to resource manager ,i m getting runtime exception

Thanks for the reply. You are correct. It uses proxy settings that I have set through IE. But I was trying to set proxy from withing my code. The first option that hit me was by importing wininet.dll. All is fine for setting simple options but for setting Proxy, there is structure INTERNET_PROXY_INFO which has LPCTSTR members. I can simply use 'int' type replacing 'DWORD' but no idea for pointer to string in C#.

hi all there
i wanna help..i m trying to open a web page onclick event of a button when the page gets displayed in axwebbrowser control.
problem is page gets displayed as a seprate window but i want it to open in the same (parent) window..any ideas
thanks,
Jill

Using SendKeys.Sendwait() fn is not solving the webbrowser problem. This Problem persists in all Microsoft languages like(VB6,VB.Net,C#.Net).
In MFC application this problem is not there. This problem is causing a lot of trouble to me.Please help me in this regard.

Hi,
Does anyone have any idea on how to stream xml data(no xsl transformation to be applied) to an AxWebBrowser, without saving it on disk. I have tried using persistentStreamInit.Load() to send a stream, but it doesnt work.

nice article i must say,i did learn how to write HTML without writing in a File but i want to capture click event and perform some action that is on clicking a link i can capture the Inner HTML of some DIV etc

Dim RegKey As RegistryKey = Registry.CurrentUser.OpenSubKey("Software\Microsoft\Windows\CurrentVersion\Internet Settings", True)
' to enable and set proxy in IE to variable strProxy
' the string is in format 'IPofProxy:port' --> '192.168.1.1:8080'
' or 'NAMEofProxy:port' --> 'proxyserver.com:8080'
' and action variable is true
' to disable use of proxy, set action to false
If action = True Then
RegKey.SetValue("ProxyServer", strProxy)
RegKey.SetValue("ProxyEnable", 1)
Else
RegKey.SetValue("ProxyEnable", 0)
End If

If you use InternetSetOption(IntPtr.Zero, INTERNET_OPTION_PROXY,...), you switch global proxy settings for full environment. For many applications it's unsuitable. You need to transmit HINTERNET handle of session to InternetSetOption to switch settings for application, but that's appropriable only if InternetOpen()/etc. functions were used for connections. ActiveX control (shdocvw.dll), and, of course, wrapper System.Windows.Forms.WebBrowser, that appear in .NET Framework 2.0, doesn't give HINTERNET handle. We can't ever say that they use this method.

Another way that was proposed on thread - modify registry - has the same problem. It affects whole user environment.
If you implement IDocHostUIHandler interface (of course in class that also implement IOleClientSite and assign that client site to browser using browser.SetClientSite()), you will be able to switch path where IE will take settings for application:
void IDocHostUIHandler.GetOptionKeyPath(out string pchKey, uint dw)
{
pchKey = "Software\\TestTest";
}
but it looks like IE doesn't try to look for proxy settings there. Many other settings can be configured, but not proxy one...
Question is: how MyIE guys do this?? Or no one uses ActiveX in production the same way as we are? Or Everyone is happy with good old IE settings?

I've run into a similar problem as mentioned above. How do I set Customized Proxy Settings for a specific webbrowser control? I've tried using:

IDocHostUIHandler.GetOptionKeyPath
and
IDocHostUIHandler2.GetOverrideKeyPath

but neither one of these seems to work. Is it not possible to have a specific webbrowser control access the internet thru a proxy while leaving the regular connection to the internet alone for all other instances of IE?

This does not work, I only see the complete translated text in one go at the end, not one by one as I need.

If I put in a MessageBox after each write(), I am able to see the sentences displayed one by one, after I click OK on the MessageBox each time. But if there is no MessageBox I am not able to see the text appear incrementally.

How can I make text appear incrementally on the browser as I write it to IHTMLDocument2?

can you take a look at my code. im trying to fill a text box in a webpage that ive loaded in my browser control. but it update it. the attribute does get set though because the on the second click the is see the correct value. only it doesnt write on the textbox in the page like i want it to.
heres the code:

Not sure exactly what you're after, but if you want to "attach" to an open IE window then you'd want to use IE automation to do that. Google for "InternetExplorer.Application" and you're bound to find some good examples of that.

I am wondering if you could help clarify something, why the Environment.GetFolderPath(Environment.SpecialFolder.MyComputer)
does not resolve into anything as I need to give a string path to my
axWebBrowser1...it seems because it is a virtual path, it does not resolve...anyway around this you know of???

What path are you expecting it to resolve to? Environment.SpecialFolder.MyComputer doesn't resolve to a path because it is not one. You cannot place files or anything there so what exactly are you after?

There are lots of questions about setting the default printer - here and elsewhere on the net... Since it was a pain in the _ for me, I figured I'd post what I found here... Created a method in fact - just reset the default before the print and reset to the original default afterwards...

This is all very new and very confusing to me, however, I have a webbrowser control embedded in my form. When I reach a specific web page in that browser, I need two things to happen. First I need to invoke a JavaScript function on that page, and following that I need the submit1 button to be clicked.

I am implementing table management in my html editor...
can any body guide me or provide me some reference.I dont want to use mshtml because then i will be dependent on it.
Can any body help me please
waiting for your response
inamgull@gmail.com

Very nice article. Exactly what I need. I'm having problems implementing it into my own code, however. When I try to use the control on a form created by my main form, I get this error: Unhandled Exception: Method 'Navigate' cannot be invoked at this time.

I m opening the pdf file in WebBrowser control in an c# application and i want to capture the events and pass it to other form, But the document is null in this case.How can i capture the events with pdf like Click, Scroll, Navigate.

I am using WebBrowser in a C++ program and am loading an HTML file which has hyperlinks for navigation within the file.

I have no problem navigating around the file programtically using the WebBrowser Navigate method however I have noticed that whenever I hit a hyperlink, and then try to navigate programatically, the file first needs to reload. This only happens when I hit a hyperlink.

I am trying to capture a file that has been downloaded from a website (a csv list of bank transactions) I want to grab the file contents without any of the FileDownload dialogs being displayed, so I can process the transactions. I have added the FileDownload event hanlder, but not sure what to do next. Does anyone have any sample code that shows how to do this?

"Great post, now that I can tie my shoes I've found I can run 5k now, but now I want to run 10k - any ideas"
and
"I have tied now the shoe, i want now to open the shoe store- any help please thank you"

(you know who you are if you comment like this)

Why don't you try this stuff yourself, and comment on your experience, instead of just spamming your needs. I know I won't change you by posting this, I just had to chip in... Thanks Ryan, for your brilliance, time, and PATIENCE with your readers :)

We have a web application loaded in a Webbrowser control embedded in our C# application. At a particular instance there will be a PDF file displayed in one of the frames of the web application in the webbrowser cntrl. The challenging task i am facing is to get the PDF downloaded to a particular folder in the local hard drive without user intervention(with out having a "Save As" dialog popping up) . The "ExecCommand" and "WebBrowser1.ExecWB OLECMDID_SAVE" didnt solve my purpose. I actually got solved in VB6 with an Inet Control.

Adding to my previous post I got it solved in VB6 with a combination of webbrowser & Inet control. I took the PDF URL from the Navigate complete event and passed to the Inet Control and it was perfect. But couldnt get it working C#.

I tried using WebClient for the same purpose. But couldnt get it working too. Adding to this.. The web application loaded in Webbrowser cntrl needs NT authentication to login in.

Hello i have been using the axwebborwser in my application and initially i used the HTMLDocument interface to cast my document but later on due to the requiremnt for a mousedown event over the control i used the HTMLDocumentClass instead. The first works fine on system that has only framework but not visual studio, the later dosent work it needs both of them, what may be the problem can you pelase help me with this,
thank u

My goal is to use a editable web browser. Until now everything ok BUT now I have a stone in my shoe. I am looking for an event which performed whenever the HMTL string is modified or whenever a object (image for ex) is added in the web page.

Brilliant. Absolutely brilliant. I searched for ages to find an answer to a problem everybody here thought was unsolveable and you had it. I've used various bits of code from various comments on this post, and cobbled them together into a way to print HTML documents (properly rendered) from the server side (including sending them to a completely different printer). This has been my "Holy Grail" for ages now and it's finally solved.

The following snippets will copy the selection in the browser control to the clipboard either as HTML or as text. ActiveBrowser is your WebBrowser control. Note that for this to work, the computer needs to have mshtml.dll. This is installed by VS but not standard as a part of .NET so be sure to distribute it or it will crash when either of these functions are called.

hi i am having a problem with my application i need to get a finding a text in a web browser can any one help me out plzz

ex i am having a text like hi this is a web browser
i have a text box ans search button out side the web browser and when i enter web in the text box and click search that text web shuold be highlighted plz can any one help me out its very urgent

When I run this code in Production and Dont use NGEN on my application EXE everything works fine, but as soon as I use NGEN the code doesn;t work. I get "Object Reference Not Set to An Object" because of AxWebBrowser1.Document is giving as Nothing.

Within one of our applications, .NET Managed Browser control is used. We recently converted our application from .NET Framework 1.1 to 2.0 and started using the managed browser control provided by the framework (2.0). The application started experiencing the following behavior since we started using the managed browser control provided by 2.0.

Our web pages (delivered by the managed browser control) contain text box controls. When the focus is in the textbox, the entire text is selected using a JavaScript method and this is accomplished by calling the JavaScript method on onfocus event of the control.
As a result, when tabbed to a textbox control on the web form (loaded by the browser control), the entire text is selected.
At this point, user (application user) is unable to place the cursor in the middle of text using mouse.
We have even written a sample application to eliminate parameters within our application as potential factors and experienced the same behavior.

Hi all
It is great article. I also have a problem. In my application I open text file in web browser and focus is set to it. I have done this part. now I need to load another winform when press left arrow key in the keyboad.

Do you know if the web browser control uses it's own cache management? I'm using Fiddler 2.x and the requests don't appear to be getting a 304 (use cache) but get a 200 instead. If I check the IE cache after, the page does exist there. This is mainly javascript references.

I'm trying to navigate, using the web browser, to an excel file that has a password. I would like to pass to the browser the file's password, so that the browser will open the file without asking the user the password. I would also like to open the excel file as readonly. Do you know how can i do this?

I'm using WebBrowser control in my windows application.I am using text box to enter reuired URL which is to be displayed in webBrowser control.

But,here my problem is if i enter proper URL like http://www.google.com,
WebBrowser control displaying that URL.Next time if i enter URL like "http://" ,WebBrowser control not updating the previous page.It is displaying the previously set page only.

WebBrowser control working fine with proper URL'S ,But if i give URL like http:// this control is not updating the previous screen.

hi i m making web browser in c#.net and using the browser control. But i need to set the proxy setting i.e. proxy name and port number. I tried to do using the webProxy class but invain.. Please Help!!!!

Is it possible to get the location of a hyperlink in the screen.. i.e if i have an href in a page loaded via the browser component, is it possible to know that this hyperlink is in the (x,y) coordinates of the screen??

I have an application which loads html content from local files on a web browser control in my form, this content has hyperlinks in it, on clicking on hyperlink, it opens a web browser in a new window. i want to capture the URL of this new window and i want to open the URL in the same browser control that i am having on the form. how can I do that?

I have used the webbrowser control to automate the IE and could log into the site.. Now i have a problem with data retrieval. The data is stored in table and I want to extract that data as objects.. Is that anyway to do that in DOM... Please advice me the steps to be taken for that objective... Thanks in advance..

I need your Help!!i built a application with a webbrowser control inside. The source of the webbrowser is only one site, its a php-search. When the user finished the search he must click on a button. This activates a php funktion an i get a xml document in a saveFileDialog.

Now my question:Is it possible, to hide the saveFileDialog from the user and save the xml document to a defined path. Maybe you have another idea how i can solve this problem.

In the end i have to get some attribute-value pairs from the xml document.

@Mike Dev - As far as I understand your question, your problem is how to stretch the browser control itself, right? And not the page.If so - you have two options - 1. To use the managed web browser control and set its Dock property to Fill.2. To resize the browser (as you are doing in your sample). I am not quite sure what is the problem with your code. It may not resize well as your code isn't called ? Try put this code in your form On_Paint event handler (it solves this problem for me once).

P.S. - you may set the parent of the web browser only once, but move the part of code which will resize it to the On_Paint event so it will get executed each time your form is repainted.

Hi iam using webbrowser conntroll, and i have collection of radiobutton with same id , name and diffrent value , when my web page load , its going to dafult cheked true 2nd RDbutton, i want that to move to 3rdRDbutton programaticaly , the web page i am accessing is 3rd party website

how can i get specifc Hetmlelemt by value and get click or chked is true, Pls mail me back skvus@yahoo.com

Is there a way to determine the lastmodified date of page. I know it can be done using http header but when i tried to do this with http header it returns me current date and time of my machine. I am using C#.net. Is there any other way to do this.

can some one let me know how clear session cookie for a particular url or domain?as per one solution, call ://To clear all session cookies, call InternetSetOption(IntPtr.Zero, INTERNET_OPTION_END_BROWSER_SESSION, IntPtr.Zero, 0);

but this seems to clear all session cookie even from other web browser windows running (We spawn 6 different web browser controls in separate thread)

I have one major problem, i use WebBrowser (say Wb1)control in vb.net 2.0. I have loaded a html page that contains flash in wb1. i had 2 buttons in flash both working fine. if i click on the browser any where else and click on the button, button is not working. I was advisd to use axWebBrowser to solve this issue. I changed control axWebBrowser instead of webbrowser control. Now button problem solved, now i come across new problem. I am not able to get event from flash to VB.Net. I don't know how to embed event in vb.net for objects in html that i am showing in axWebBrowser. that is if i click a link in axWebBrowser the event have t come to vb.net

I'm taking my first steps in C# after years of programming in Java (but during my own hors ! I'm a Java amateur not a Java pro).One of my first exercises was to build a form containing a textbox, a button and a webbrowser. The textbox was for the URL. And thanks to this blog, I found out how it works. Thanks a lot.

Hi,I am using a AxWebBrowser control in my windows app. I open a new window in which I navigate to a 3rd party page. There are several links on the page and clicking on each link, the page size changes. Is it possible to change the size of my form accordingly?? Please help!

Cool Document. I opened a word document in web browser control (vb.net) but the right click with all word properties is enabled. There is no option for saving the changed document. I want to disable the right click event of web browser control when it opens a word document in it...

I am trying to submit a form using a web browser control. After submitting the form setting required params, the expected page loads correctly but I am not able to access the submitted page source code (HTML). Should I do something to refresh the webbrowser control document in order to access the second page HTML? if I do could you tell me how to do it ?

I'm using the MS WebBrowser control in Visual Studio 2008. No matter what (small) font size i specify ir refuses to go below about 10pt. I could not figure out how to get the font size below that (like Frontpage does). Any ideas? Thank you.

Hello Ryan,I have a web browser control, when I navigate to my site using web browser control it works fine until 'window.open' is used to open a new page in new window. The session is lost when the window is opened in new window, can you suggest a solution for this?

I am new to c#, I created a project(basically this is an background process) with browser control, where i need to open one url and download some files, while doing this operation this site will be poping up some alert, save or other messages, i need to caputre all the messages and work accrodingly.. could please anyone help me out overcome this problem.

sometimes i get an error that is An unhandled exception of type 'System.StackOverflowException' occurred in mscorlib.dll

why does it happen? what should i do?

second one is, i try to open an url. when i open webpage it directs me another page, but it opens in another webbrowser. i want to open it in my webbrowser1. how can i that? i tried to webBrowser1.Navigate("https://www.yazilimisleri.com",false);but still it opens in another webbrowser.thanks a lot.

Hi! I m new in C#.NET tech. I want to open one url at run time means i dont need web browser control at design time. i want it at run time so how can i do it.I had tried it. by creating object of web browser at runtime using new keyword bt its not giving o/p. So can anybody help me??? Plz.

Hello !I would like to programmatically download and save the imagewebBrowser2.Url = new Uri("http://www.somewhere.com/images/captcha.png"); do { System.Threading.Thread.Sleep(100); } while (webBrowser2.IsBusy || !webBrowser2.DocumentStream.CanRead);

Bitmap i = new Bitmap(webBrowser2.DocumentStream); i.Save("myimage.jpg");Error i have is :System.ArgumentException: Parameter is not valid. at System.Drawing.Bitmap..ctor(Stream stream) I want to use webBrowser to download image .what wrong with my code ? it dont work , hix .I want to use webBrowser to download image in this session because this image is randomly generated in every request, for example, if i open the page it show an image, if i refresh the page the image changes.Thanks in advance

Hi,I am using web browser control in winforms. I loading almost a file of size 5MB using webBrowser.Navigate(@"C:\Log.html"). It navigates fine. Now I have problem. Once I scroll down to the end of the page and minimise, my application will hang for some time and when I bring the form from minimise state to normal it again hangs for some time and it appears that the page is loading once again. The scroll bar position also changes and moves up from the end of the page. can you help me. Thanks in advance..

Thanks very much for this! I know this is an old solution, but in my new app (WPF running on Vista or Win7) it seems to work just fine. I looked at all sorts of other ideas for printing a document from a browser in WPF (something that the Winforms webbrowser supported natively with a .Print method), and this is the only one I could get working. It also seems more reliable than the other methods, which involved trying to send a CTRL/P to the web browser command.

The link to the list of dhtml commands is broken; this one seems to work though:

Im using the system.windows.forms.webbrowser in VS2008 Sp1 on Windows 7 to create a simple file viewer (PDF,JPG files).It all works nicely except that images doesnt rezise as they should, e.g if i open the image file in IE directly it resizes(I have set the Tools,Internet options,Advanced,Settings,Multimedia\Enable Automaic image resizing)option), any ideas why the webbrowser control doesn't work the same as IE8 on this?

Help me please. I use webbrowser in VB.Net 2005 to browse a webpage. In this webpage it's a link to another webpage who opened in new window of internet explorer ... my default explorer. My problem is the internet explorer new page don't remember/used cookies of webbrowser.

hi i have problem with my codethe source code of web site doesnt shows the name and id property of button but i wish click on that programmatically because i m trying develope new software for my some office work. the source code of the button only shows value property. so can you please help me to solve this please send me reply on my email adress its really helpfull for me.i m developing the software in c#.netthank you,

I am using Axbrowser COM control in my Window application for last 5 years. It was working fine. Now some times it going crazy. I am displaying XML/XSL files. It displays for some times and all of sudden it will display blank page. Then i need to restart the system then it will work for some time and again same thing repeats. Not able to figure out wats the problem. Installed all the recent updates by Microsoft is that a problem? I tried removing some updates and then also it is behaving same. Can you help me out.. thanks in advance.

However the value in the range.htmlText differs from the actual source, such as the removal of "" (in some cases), the inclusion of "\r\n" in other cases and the order of the attributes. Do you know of any work around or why this might be happening?

Is there any way to control the page margins, header, footer settings with code? I know I can change the settings in IE that make it work with this control but I wanted to do that programmatically. Also, how can I make it print silently? The code "doc.execCommand("Print", false, 0);" doesn't seem to work properly. I still get the print dialog when I set that second parameter to false..

Hii need in webbrowser componentsearch a specific link by InnerTextfocus on it()and invoke a right click and press Copy Shortcut(Really i need copy shorcut not work for me getatribute("href"))if you know something help me any book of complette webbrowser component or you knot how make it really thanks in advanceJuano