Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C#
  4. Open a Web Browser

Open a Web Browser

Scheduled Pinned Locked Moved C#
questiontutorial
7 Posts 5 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • G Offline
    G Offline
    gonad
    wrote on last edited by
    #1

    Can someone show me how i can open Internet Explorer by clicking on a button? I'm having a hard time finding out how to do this... Thank you for taking time with this lame-o question. :)

    O U 2 Replies Last reply
    0
    • G gonad

      Can someone show me how i can open Internet Explorer by clicking on a button? I'm having a hard time finding out how to do this... Thank you for taking time with this lame-o question. :)

      O Offline
      O Offline
      OmegaSupreme
      wrote on last edited by
      #2

      Hi .gonad, This works System.Diagnostics.Process.Start("http://www.codeproject.com/"); BUT if a browser is open it uses that instead, which is quite anoying for the user I spose. :(

      G 1 Reply Last reply
      0
      • O OmegaSupreme

        Hi .gonad, This works System.Diagnostics.Process.Start("http://www.codeproject.com/"); BUT if a browser is open it uses that instead, which is quite anoying for the user I spose. :(

        G Offline
        G Offline
        gonad
        wrote on last edited by
        #3

        Thank you for your response! :) This will work perfectly for my situation. Have a blessed day!

        O 1 Reply Last reply
        0
        • G gonad

          Thank you for your response! :) This will work perfectly for my situation. Have a blessed day!

          O Offline
          O Offline
          OmegaSupreme
          wrote on last edited by
          #4

          np, have a good day yourself :D

          1 Reply Last reply
          0
          • G gonad

            Can someone show me how i can open Internet Explorer by clicking on a button? I'm having a hard time finding out how to do this... Thank you for taking time with this lame-o question. :)

            U Offline
            U Offline
            Utku KAYA
            wrote on last edited by
            #5

            This piece of code runs well for a new browser. Dont forget to give a reference to ExplorerLib.dll ExplorerLib.InternetExplorer explorer; ExplorerLib.IWebBrowserApp webBrowser; explorer = new ExplorerLib.InternetExplorer(); webBrowser = (ExplorerLib.IWebBrowserApp) explorer; webBrowser.Visible = true; webBrowser.Url or something like that = "yourURL";

            S 1 Reply Last reply
            0
            • U Utku KAYA

              This piece of code runs well for a new browser. Dont forget to give a reference to ExplorerLib.dll ExplorerLib.InternetExplorer explorer; ExplorerLib.IWebBrowserApp webBrowser; explorer = new ExplorerLib.InternetExplorer(); webBrowser = (ExplorerLib.IWebBrowserApp) explorer; webBrowser.Visible = true; webBrowser.Url or something like that = "yourURL";

              S Offline
              S Offline
              Shehzad Salim
              wrote on last edited by
              #6

              where to give the url there is nothing webBrowser.Url or something like that

              H 1 Reply Last reply
              0
              • S Shehzad Salim

                where to give the url there is nothing webBrowser.Url or something like that

                H Offline
                H Offline
                Husein
                wrote on last edited by
                #7

                You could also do the following: Add reference to "Microsoft Internet Controls" (that is SHDocVw.dll) in the COM tab. Use this code: string URL = "http://www.codeproject.com"; SHDocVw.InternetExplorer ie = new SHDocVw.InternetExplorerClass(); object empty = null; ie.Navigate(URL, ref empty, ref empty, ref empty, ref empty); ie.Visible = true; This should solve your problem.

                1 Reply Last reply
                0
                Reply
                • Reply as topic
                Log in to reply
                • Oldest to Newest
                • Newest to Oldest
                • Most Votes


                • Login

                • Don't have an account? Register

                • Login or register to search.
                • First post
                  Last post
                0
                • Categories
                • Recent
                • Tags
                • Popular
                • World
                • Users
                • Groups