Blog Home  Home RSS 2.0 Atom 1.0 CDF  
Ruminations of a Developer - Opening Internet Explorer Using C# Windows
Mark Bonafe
 
 Monday, February 20, 2006

So now you have a nice report written to an HTML file.  How do you open it for the user to view it using IE?  You could try this:

System.Diagnostics.Process.Start("iexplore.exe","MyReport.htm");

But this hasn't always worked for me.  Here is a sure fire way to put it all together.

Add a project reference to the COM library, Microsoft Internet Controls.  Add these two using statements:

using SHDocVw;
using System.Runtime.InteropServices;

Where you need to open the browser, add the following code:

explorer = new InternetExplorer(); 
if (explorer != null

     explorer.Visible = true
     object x = null;
     explorer.Navigate(@"MyReport.htm
", ref x, ref x, ref x, ref x); 
}

Thanks to a good friend of mine, Micheal Beall of Overdrive Technologies, for helping me with this.

***Originally posted on DotNetJunkies on February 16, 2005

2/20/2006 2:10:49 PM (Eastern Standard Time, UTC-05:00)  #    Comments [0]    |  Trackback
Name
E-mail
Home page

Comment (HTML not allowed)  

Enter the code shown (prevents robots):

Copyright © 2010 Mark Bonafe. All rights reserved.