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. Launch txt file in deafult text editor

Launch txt file in deafult text editor

Scheduled Pinned Locked Moved C#
windows-admintutorial
4 Posts 3 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.
  • D Offline
    D Offline
    Dwayner79
    wrote on last edited by
    #1

    I need a function that launches a text file in the users default text editor. It would be easy enough to launch notepad, but notepad is horrid. How to I grab the executable that is used for the .txt extension. I assume this is a registry thing, and I have avoided the registry in the past. Thanks.

    ***************** "We need to apply 21st-century information technology to the health care field. We need to have our medical records put on the I.T." —GW

    C L 2 Replies Last reply
    0
    • D Dwayner79

      I need a function that launches a text file in the users default text editor. It would be easy enough to launch notepad, but notepad is horrid. How to I grab the executable that is used for the .txt extension. I assume this is a registry thing, and I have avoided the registry in the past. Thanks.

      ***************** "We need to apply 21st-century information technology to the health care field. We need to have our medical records put on the I.T." —GW

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

      You use Process.Start and pass it the path to your txt file. It's probably going to open notepad.

      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 )

      1 Reply Last reply
      0
      • D Dwayner79

        I need a function that launches a text file in the users default text editor. It would be easy enough to launch notepad, but notepad is horrid. How to I grab the executable that is used for the .txt extension. I assume this is a registry thing, and I have avoided the registry in the past. Thanks.

        ***************** "We need to apply 21st-century information technology to the health care field. We need to have our medical records put on the I.T." —GW

        L Offline
        L Offline
        Luc Pattyn
        wrote on last edited by
        #3

        Hi, if you pass a .txt file as the command to Process.Start() it will be opened by whatever app is associated to the .txt extension (which could be Notepad of course). :)

        Luc Pattyn [Forum Guidelines] [My Articles]


        this months tips: - use PRE tags to preserve formatting when showing multi-line code snippets - before you ask a question here, search CodeProject, then Google


        D 1 Reply Last reply
        0
        • L Luc Pattyn

          Hi, if you pass a .txt file as the command to Process.Start() it will be opened by whatever app is associated to the .txt extension (which could be Notepad of course). :)

          Luc Pattyn [Forum Guidelines] [My Articles]


          this months tips: - use PRE tags to preserve formatting when showing multi-line code snippets - before you ask a question here, search CodeProject, then Google


          D Offline
          D Offline
          Dwayner79
          wrote on last edited by
          #4

          Both of you THANKS! and DUH on me. Many users will have notepad, but I know the particular user I am dealing with uses textpad. I wanted it to just call whatever is associated. Thanks again.

          ***************** "We need to apply 21st-century information technology to the health care field. We need to have our medical records put on the I.T." —GW

          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