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 nodepad.txt in c# program

open a nodepad.txt in c# program

Scheduled Pinned Locked Moved C#
questioncsharp
6 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.
  • F Offline
    F Offline
    faladrim
    wrote on last edited by
    #1

    hi, i keep a logging in a .txt file, i would like to open this file by pressing a button in my program. how do i do this? is this even possible?? thx grz

    R C G 3 Replies Last reply
    0
    • F faladrim

      hi, i keep a logging in a .txt file, i would like to open this file by pressing a button in my program. how do i do this? is this even possible?? thx grz

      R Offline
      R Offline
      rah_sin
      wrote on last edited by
      #2

      u can try System.Diagnostics.Process.Start("complete path of file\\filename.txt");

      rahul

      1 Reply Last reply
      0
      • F faladrim

        hi, i keep a logging in a .txt file, i would like to open this file by pressing a button in my program. how do i do this? is this even possible?? thx grz

        C Offline
        C Offline
        coolestCoder
        wrote on last edited by
        #3

        Hi, Yes ! Either you can open the text file using the IO classes provided in the .Net or you can directly open that file in notepad using Process.Start(). Have look here[^]


        "A good programmer is someone who looks both ways before crossing a one-way street." -- Doug Linder


        coolestCoder

        F 1 Reply Last reply
        0
        • C coolestCoder

          Hi, Yes ! Either you can open the text file using the IO classes provided in the .Net or you can directly open that file in notepad using Process.Start(). Have look here[^]


          "A good programmer is someone who looks both ways before crossing a one-way street." -- Doug Linder


          coolestCoder

          F Offline
          F Offline
          faladrim
          wrote on last edited by
          #4

          thanks alot !! :) can i make it a read only to? so people cant change it. thx

          E 1 Reply Last reply
          0
          • F faladrim

            thanks alot !! :) can i make it a read only to? so people cant change it. thx

            E Offline
            E Offline
            Eduard Keilholz
            wrote on last edited by
            #5

            then you should open the text from within your program and display in a Read-only (or disabled) text control. You cannot open en text in notepad and somehow disable it from editing. StreamReader srMyLogfile = new StreamReader("path/to/file.txt"); txtYourTextbox.Text = sr.ReadToEnd(); txtYourTextbox.Enabled = false; srMyLogfile.Close(); srMyLogfile.Dispose();

            - - - --[ i love it when a plan comes together ]-- - - -

            1 Reply Last reply
            0
            • F faladrim

              hi, i keep a logging in a .txt file, i would like to open this file by pressing a button in my program. how do i do this? is this even possible?? thx grz

              G Offline
              G Offline
              GaryWoodfine
              wrote on last edited by
              #6

              I have written a blog post that show's you to read and write a text file hope this helps you. http://threenineconsulting.com/forum/blogs/cykophysh/archive/2006/11/24/Write-and-Read-a-Text-File-In-C_2300_.aspx

              Kind Regards, Gary


              My Website || My Blog

              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