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. Visual C# Button Link to website

Visual C# Button Link to website

Scheduled Pinned Locked Moved C#
csharp
15 Posts 4 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.
  • B Benjamin Dodd

    Thanks for your help.

    N a v a n e e t h wrote:

    Open that file using Process.Start() method

    so, example - Process.Start(C:\Documents and Settings\stc12191\My Documents) is that right :s i saved a webpage in my documents, so if i use the code: Process.Start(C:\Documents and Settings\stc12191\My Documents) will that open the web page :) thanks

    Benjamin Dodd

    C Offline
    C Offline
    Christian Graus
    wrote on last edited by
    #5

    Benjamin Dodd wrote:

    i saved a webpage in my documents, so if i use the code: Process.Start(C:\Documents and Settings\stc12191\My Documents) will that open the web page

    No. 1 - you didn't put the string in quotes 2 - if you have 20 web pages in this folder, how would you expect windows to just pick one, or even know you wanted to open a web page ? Process.Start starts a program, and if you give it a file, it tries to open it with the default program. So, if you put the name of the htm file at the end of that path, that will work.

    Christian Graus - Microsoft MVP - C++ "I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )

    B 1 Reply Last reply
    0
    • C Christian Graus

      Benjamin Dodd wrote:

      i saved a webpage in my documents, so if i use the code: Process.Start(C:\Documents and Settings\stc12191\My Documents) will that open the web page

      No. 1 - you didn't put the string in quotes 2 - if you have 20 web pages in this folder, how would you expect windows to just pick one, or even know you wanted to open a web page ? Process.Start starts a program, and if you give it a file, it tries to open it with the default program. So, if you put the name of the htm file at the end of that path, that will work.

      Christian Graus - Microsoft MVP - C++ "I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )

      B Offline
      B Offline
      Benjamin Dodd
      wrote on last edited by
      #6

      Christian Graus wrote:

      if you have 20 web pages in this folder, how would you expect windows to just pick one, or even know you wanted to open a web page ?

      ooops i forgot that bit :( thanks for your help is this right then ("C:\Documents and Settings\stc12191\My Documents\google") ps. i cannot check the code now as i am not on my laptop which has c# installed

      Benjamin Dodd

      C 1 Reply Last reply
      0
      • B Benjamin Dodd

        Christian Graus wrote:

        if you have 20 web pages in this folder, how would you expect windows to just pick one, or even know you wanted to open a web page ?

        ooops i forgot that bit :( thanks for your help is this right then ("C:\Documents and Settings\stc12191\My Documents\google") ps. i cannot check the code now as i am not on my laptop which has c# installed

        Benjamin Dodd

        C Offline
        C Offline
        Christian Graus
        wrote on last edited by
        #7

        So long as google is the name of a html file, and so long as IE can work that out without the file extension being present.

        Christian Graus - Microsoft MVP - C++ "I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )

        B 1 Reply Last reply
        0
        • C Christian Graus

          So long as google is the name of a html file, and so long as IE can work that out without the file extension being present.

          Christian Graus - Microsoft MVP - C++ "I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )

          B Offline
          B Offline
          Benjamin Dodd
          wrote on last edited by
          #8

          yep, thanks alot mate for the help i will try this now as i have just loaded up my laptop thanks

          Benjamin Dodd

          1 Reply Last reply
          0
          • N N a v a n e e t h

            Benjamin Dodd wrote:

            how this same button can also open a website URL.

            Create a new website url shortcut file. Open that file using Process.Start() method


            My Website | Ask smart questions

            B Offline
            B Offline
            Benjamin Dodd
            wrote on last edited by
            #9

            N a v a n e e t h wrote:

            Create a new website url shortcut file. Open that file using Process.Start() method

            This code didn't work :( i am using Visual C# 2005 express edition it said that ''Process' does not exist in the current context' am i doing something wrong here? i put this code under the 'button1_Click' area

            Benjamin Dodd

            M 1 Reply Last reply
            0
            • B Benjamin Dodd

              N a v a n e e t h wrote:

              Create a new website url shortcut file. Open that file using Process.Start() method

              This code didn't work :( i am using Visual C# 2005 express edition it said that ''Process' does not exist in the current context' am i doing something wrong here? i put this code under the 'button1_Click' area

              Benjamin Dodd

              M Offline
              M Offline
              Martin 0
              wrote on last edited by
              #10

              Hello, using System.Diagnostics;

              All the best, Martin

              B 1 Reply Last reply
              0
              • M Martin 0

                Hello, using System.Diagnostics;

                All the best, Martin

                B Offline
                B Offline
                Benjamin Dodd
                wrote on last edited by
                #11

                It says Process 'does not exist in the current context. What am i doing wrong? :(

                Benjamin Dodd

                B M 2 Replies Last reply
                0
                • B Benjamin Dodd

                  It says Process 'does not exist in the current context. What am i doing wrong? :(

                  Benjamin Dodd

                  M Offline
                  M Offline
                  Martin 0
                  wrote on last edited by
                  #12

                  Hello, The compiler doesn't know which Process class you mean. You could set a using statement at the top of your class (under "using System;"), or use the full qualified name instead (System.Diagnostics.Process)

                  All the best, Martin

                  B 1 Reply Last reply
                  0
                  • B Benjamin Dodd

                    It says Process 'does not exist in the current context. What am i doing wrong? :(

                    Benjamin Dodd

                    B Offline
                    B Offline
                    Benjamin Dodd
                    wrote on last edited by
                    #13

                    C# reversed the code for me....now it says 'System.Diagnoatics.Process' and recognises this. After this i put....'.("C:");' now it says.....Identifier expected and higlights the '('

                    Benjamin Dodd

                    M 1 Reply Last reply
                    0
                    • B Benjamin Dodd

                      C# reversed the code for me....now it says 'System.Diagnoatics.Process' and recognises this. After this i put....'.("C:");' now it says.....Identifier expected and higlights the '('

                      Benjamin Dodd

                      M Offline
                      M Offline
                      Martin 0
                      wrote on last edited by
                      #14

                      Have you ever considert reading the dokumentation?[^]

                      All the best, Martin

                      1 Reply Last reply
                      0
                      • M Martin 0

                        Hello, The compiler doesn't know which Process class you mean. You could set a using statement at the top of your class (under "using System;"), or use the full qualified name instead (System.Diagnostics.Process)

                        All the best, Martin

                        B Offline
                        B Offline
                        Benjamin Dodd
                        wrote on last edited by
                        #15

                        thanks

                        Benjamin Dodd

                        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