| Business Application Development with: SQL Server, C#, VB, VB.Net, ASP, ASP.Net, and XML |
| N | S |
Novick Software Management • Design • Programming • Training • Consulting |
|
|
News Links Schedule Site Map Contact |
|
Tips and Tricks for: C#The Problem: Opening a Internet Explorer browser window to a specific URLWhen you want the user to see a web page, you've got to open a new browser window and navigate it to the desired URL. The examples in the documentation are all in Visual Basic 6 or VBScript. How do you do it in .Net? Solution: Create and use the COM object InternetExplorer.ApplicationThis routine IEOpenURL shown below does the job. You'll need to start by adding a reference to the shDocVw.Dll. It shows up as AXSHDocVW in the References branch of Solution Explorer. You'll also need the COMCreateObject function. The IDOpenURL function is static so I usually include it in my NSLibStatic class. The sole purpose of the class is to hold static methods that I write. You can put it anywhere you like. The file that holds the routine needs this using statement:
Then put this method into one of your classes:
To call it, just supply the URL (assumes the function is in the NSLibStatic class:
|
|
|
Copyright © 2003-2008 Novick Software, Inc. | Terms of Use | Privacy Policy | Nice Things People Say| |