#1
  1. Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Mar 2005
    Posts
    296
    Rep Power
    15

    C#: Open webpage in browser from windows control


    Hi,

    I have seen many articles explaining how to open a webpage via an ASP.NET web control but I need to know how to open a webpage from a Windows Form Control.

    Does anyone know what control class or command is used to do this?

    Thanks!
  2. #2
  3. I <3 ASCII
    Devshed Regular (2000 - 2499 posts)

    Join Date
    Aug 2003
    Posts
    2,400
    Rep Power
    1233
    Most that I've seen, would just launch the system command "iexplore <website>" It won't open the website in the browser of choice, but why would anything use anything other than IE?

    -MBirchmeier
  4. #3
  5. Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Mar 2005
    Posts
    296
    Rep Power
    15
    And how do you do that? I cant see iexplore anywhere.
  6. #4
  7. I <3 ASCII
    Devshed Regular (2000 - 2499 posts)

    Join Date
    Aug 2003
    Posts
    2,400
    Rep Power
    1233
    You should be able to do
    Code:
    System.Diagnostics.Process proc = new System.Diagnostics.Process();
    proc.StartInfo.Application = "iexplore";
    proc.StartInfo.Arguments = "www.google.com";
    proc.Start();
    -MBirchmeier
    <note> untested, i'm running CompactFramework currently which doesn't allow for System.Diagnostics and i'm too lazy to load up full framework currently.
    Last edited by MBirchmeier; January 11th, 2006 at 11:46 AM.
  8. #5
  9. Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Mar 2005
    Posts
    296
    Rep Power
    15
    Apparently there is no such object "Application" under proc.StartInfo
  10. #6
  11. I <3 ASCII
    Devshed Regular (2000 - 2499 posts)

    Join Date
    Aug 2003
    Posts
    2,400
    Rep Power
    1233
    Originally Posted by Cep
    Apparently there is no such object "Application" under proc.StartInfo
    Then google it it's been almost a year since i've worked in full framework, ya gotta do your own research sometimes.

    Comments on this post

    • f'lar agrees : Preach it!
  12. #7
  13. Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Mar 2005
    Posts
    296
    Rep Power
    15
    I have thats the problem everything else always refers to using the asp.net code for a web form not a windows form.
  14. #8
  15. I <3 ASCII
    Devshed Regular (2000 - 2499 posts)

    Join Date
    Aug 2003
    Posts
    2,400
    Rep Power
    1233
    System.Diagnostics.Process()

    The first few links are all relevant,

    the third (major) on even has an example of EXACTLY what you're trying to do...

    -MBirchmeier
  16. #9
  17. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Oct 2007
    Posts
    1
    Rep Power
    0

    Lightbulb don't u mean


    proc.StartInfo.FileName ="iexplore"

IMN logo majestic logo threadwatch logo seochat tools logo