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. Visual Basic
  4. textbox to a .txt

textbox to a .txt

Scheduled Pinned Locked Moved Visual Basic
help
12 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.
  • B Offline
    B Offline
    Brad
    wrote on last edited by
    #1

    Hi guys, the name pretty much says it all, I am as far as savedialogfile but i am completly stuck. My aim is to save a .txt from a textbox with a button. Thanks in advance, Brad

    C T 2 Replies Last reply
    0
    • B Brad

      Hi guys, the name pretty much says it all, I am as far as savedialogfile but i am completly stuck. My aim is to save a .txt from a textbox with a button. Thanks in advance, Brad

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

      In VB2005, there's something like File.SaveAllText("filepath", "Text");

      Christian Graus - Microsoft MVP - C++ Metal Musings - Rex and my new metal blog "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

        In VB2005, there's something like File.SaveAllText("filepath", "Text");

        Christian Graus - Microsoft MVP - C++ Metal Musings - Rex and my new metal blog "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
        Brad
        wrote on last edited by
        #3

        Hi, thanks for teh reply, i still cannot get it to work. Any more ideas or anything specific to know. Thanks

        C 1 Reply Last reply
        0
        • B Brad

          Hi, thanks for teh reply, i still cannot get it to work. Any more ideas or anything specific to know. Thanks

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

          The problem is sufficiently trivial that if you define 'cannot get it to work' and post your code, I'm sure I can help.

          Christian Graus - Microsoft MVP - C++ Metal Musings - Rex and my new metal blog "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

            The problem is sufficiently trivial that if you define 'cannot get it to work' and post your code, I'm sure I can help.

            Christian Graus - Microsoft MVP - C++ Metal Musings - Rex and my new metal blog "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
            Brad
            wrote on last edited by
            #5

            Hi Christian, At the moment i acually have no code for what i want to do as i have been trailing and erroring for a few hours now but here is screenshot of my design and the code for the form so far. 'button3' is what i want to actually save me file, as of the above posts i want to edit the textboxes and then save/overwrite teh existing file that it is reading from. Hope this helps you out with helping me. [IMG]http://i124.photobucket.com/albums/p14/Br4dZ/code.jpg\[/IMG\] Thanks again

            C 1 Reply Last reply
            0
            • B Brad

              Hi Christian, At the moment i acually have no code for what i want to do as i have been trailing and erroring for a few hours now but here is screenshot of my design and the code for the form so far. 'button3' is what i want to actually save me file, as of the above posts i want to edit the textboxes and then save/overwrite teh existing file that it is reading from. Hope this helps you out with helping me. [IMG]http://i124.photobucket.com/albums/p14/Br4dZ/code.jpg\[/IMG\] Thanks again

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

              I'm at a loss. I gave you one line of code, and you're saying you have no code in your app yet, but the line I gave you doesn't work ? File.WriteAllText will indeed overwrite the file at the path you provide, with the string you pass into it. Which bit is causing you grief ?

              Christian Graus - Microsoft MVP - C++ Metal Musings - Rex and my new metal blog "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 2 Replies Last reply
              0
              • C Christian Graus

                I'm at a loss. I gave you one line of code, and you're saying you have no code in your app yet, but the line I gave you doesn't work ? File.WriteAllText will indeed overwrite the file at the path you provide, with the string you pass into it. Which bit is causing you grief ?

                Christian Graus - Microsoft MVP - C++ Metal Musings - Rex and my new metal blog "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
                Brad
                wrote on last edited by
                #7

                VB kep throwing expression errors, i have tried to work around it but it is not working at all, I am 18 and been coding for a few months so please excuse my stupidness.

                C 1 Reply Last reply
                0
                • C Christian Graus

                  I'm at a loss. I gave you one line of code, and you're saying you have no code in your app yet, but the line I gave you doesn't work ? File.WriteAllText will indeed overwrite the file at the path you provide, with the string you pass into it. Which bit is causing you grief ?

                  Christian Graus - Microsoft MVP - C++ Metal Musings - Rex and my new metal blog "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
                  Brad
                  wrote on last edited by
                  #8

                  VB keeps on thrwoing expression errors when i use your code and havw tried to work around it to get it to work but no luck. Please excuse my stupidness as i have been coding for a few months.

                  B 1 Reply Last reply
                  0
                  • B Brad

                    VB kep throwing expression errors, i have tried to work around it but it is not working at all, I am 18 and been coding for a few months so please excuse my stupidness.

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

                    Oh, my bad. It's System.IO.File.WriteAllText if you don't have System.IO scoped in already, you need to put the whole thing.

                    Christian Graus - Microsoft MVP - C++ Metal Musings - Rex and my new metal blog "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
                    • B Brad

                      VB keeps on thrwoing expression errors when i use your code and havw tried to work around it to get it to work but no luck. Please excuse my stupidness as i have been coding for a few months.

                      B Offline
                      B Offline
                      Brad
                      wrote on last edited by
                      #10

                      My.Computer.FileSystem.WriteAllText("C:\filename.txt", TextBox1.Text, True) That is how I have done it! Thanks for the help Christian!

                      C 1 Reply Last reply
                      0
                      • B Brad

                        My.Computer.FileSystem.WriteAllText("C:\filename.txt", TextBox1.Text, True) That is how I have done it! Thanks for the help Christian!

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

                        No problem. That's a shortcut for System.IO.File.WriteAllText, it does the same thing. My is a shortcut for VB only, not C#.

                        Christian Graus - Microsoft MVP - C++ Metal Musings - Rex and my new metal blog "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
                        • B Brad

                          Hi guys, the name pretty much says it all, I am as far as savedialogfile but i am completly stuck. My aim is to save a .txt from a textbox with a button. Thanks in advance, Brad

                          T Offline
                          T Offline
                          The ANZAC
                          wrote on last edited by
                          #12

                          Dim SaveStream As System.IO.StreamWriter SaveStream = New System.IO.StreamWriter(directoryasstring.txt) SaveStream.Write(texttosaveasstring) SaveStream.Close()

                          Posted by The ANZAC

                          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