Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

Launching IE from within app

jmusyjjmusyj Member Posts: 33
I am writing a C# application using forms and I need to know how to launch IE to go to a specified website when a user clicks on the menu option. Anyone know how to accomplish this??
Thanks in advance for any help...

Comments

  • patrik66patrik66 Member Posts: 10
    : I am writing a C# application using forms and I need to know how to launch IE to go to a specified website when a user clicks on the menu option. Anyone know how to accomplish this??
    : Thanks in advance for any help...
    :

    You could try it like this.
    First add a reference to Microsoft Internet Controls

    Code sample

    SHDocVw.InternetExplorerClass ie = new InternetExplorerClass();
    object o1 = (object)"http://www.programmersheaven.com";
    object o2 = null;
    object o3 = null;
    object o4 = null;
    object o5 = null;
    ie.Navigate2(ref o1, ref o2, ref o3, ref o4, ref o5);
    ie.Visible = true;

    Hope this helps
    /Patrik

  • jmusyjjmusyj Member Posts: 33
    I got it working using this
    [code]
    System.Diagnostics.Process.Start("iexplore.exe", "http://www.programmersheaven.com");
    [/code]

    It seems to work ok. Do you know of any problems with this method??

    : : I am writing a C# application using forms and I need to know how to launch IE to go to a specified website when a user clicks on the menu option. Anyone know how to accomplish this??
    : : Thanks in advance for any help...
    : :
    :
    : You could try it like this.
    : First add a reference to Microsoft Internet Controls
    :
    : Code sample
    :
    : SHDocVw.InternetExplorerClass ie = new InternetExplorerClass();
    : object o1 = (object)"http://www.programmersheaven.com";
    : object o2 = null;
    : object o3 = null;
    : object o4 = null;
    : object o5 = null;
    : ie.Navigate2(ref o1, ref o2, ref o3, ref o4, ref o5);
    : ie.Visible = true;
    :
    : Hope this helps
    : /Patrik
    :
    :

  • ma2xma2x Member Posts: 4
    Code:

    Process ieProcess = new Process();

    ieProcess.StartInfo.FileName = @C:Program FilesInternet Exploreriexplore.exe; // the path of the program
    ieProcess.StartInfo.Arguments = "www.google.com"; // the website to navigate

    ieProcess.StartInfo.UseShellExecute = false;
    ieProcess.StartInfo.RedirectStandardOutput = true;
    ieProcess.Start(); // start the process

    Don't forget to import namespace "System.Diagnostics" where Process class is located.

    using System.Diagnostics;
Sign In or Register to comment.