How to open URL in IE from Window Application

Posted by Shahkomil under Windows Forms category on | Views : 2608
This code will explain how to open any URL(website) in Internet explorer from window application.

Folllow the steps given below:
(1)Add reference of Microsoft Internet Controls from the COM components.
(2) Add following namespace to your form.

using SHDocVw;

(3)Write below code in your Form's Load event.

InternetExplorer oIE = new InternetExplorer(); 
if (oIE != null)
object oEmpty = String.Empty;
object oURL = "";
oIE.Visible = true;
oIE.Navigate2(ref oURL, ref oEmpty, ref oEmpty, ref oEmpty, ref oEmpty);

(4) Save your form and run your application.

Comments or Responses

Login to post response