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. Add a new line to a text File

Add a new line to a text File

Scheduled Pinned Locked Moved Visual Basic
csharpc++visual-studio
3 Posts 2 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
    Bondtje
    wrote on last edited by
    #1

    Private Sub Button5_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles opslaan.Click FileOpen(1, "C:\Documents and Settings\Jurgen\Mijn documenten\Visual Studio Projects\Data test1\Data Testje 1\Log_uren_bijhouden.txt", OpenMode.Output) ' Open file for output. Print(1, TimeOfDay, Today) ' Print text to file. PrintLine(1) 'sluit 1ste regel af PrintLine(1) PrintLine(1, nummer.Text, naam.Text, achternaam.Text) PrintLine(1, "Begonnen om", TAB(1), beginuur.Text) ' Print in two print zones. PrintLine(1, "Beeindigd om", TAB(1), eindeuur.Text) ' Separate strings with space. PrintLine(1) PrintLine(1, TAB(10), "END", TAB(20), "END") ' Print word at column 10. PrintLine(1, "-------------------------------------------------------------------") FileClose(1) ' Close file. End Sub I want to add every time I klik a Button a new line with these text in the file. now when i try to do that he overwrites every time the existing Data. It has to somthing like a log file. I use Visual Basic.net, this because i can't work very wel with C++ Sombody a hint or a Solution, Thanks Jurgen De Bondt Thats ........ Me

    D 1 Reply Last reply
    0
    • B Bondtje

      Private Sub Button5_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles opslaan.Click FileOpen(1, "C:\Documents and Settings\Jurgen\Mijn documenten\Visual Studio Projects\Data test1\Data Testje 1\Log_uren_bijhouden.txt", OpenMode.Output) ' Open file for output. Print(1, TimeOfDay, Today) ' Print text to file. PrintLine(1) 'sluit 1ste regel af PrintLine(1) PrintLine(1, nummer.Text, naam.Text, achternaam.Text) PrintLine(1, "Begonnen om", TAB(1), beginuur.Text) ' Print in two print zones. PrintLine(1, "Beeindigd om", TAB(1), eindeuur.Text) ' Separate strings with space. PrintLine(1) PrintLine(1, TAB(10), "END", TAB(20), "END") ' Print word at column 10. PrintLine(1, "-------------------------------------------------------------------") FileClose(1) ' Close file. End Sub I want to add every time I klik a Button a new line with these text in the file. now when i try to do that he overwrites every time the existing Data. It has to somthing like a log file. I use Visual Basic.net, this because i can't work very wel with C++ Sombody a hint or a Solution, Thanks Jurgen De Bondt Thats ........ Me

      D Offline
      D Offline
      Dave Kreskowiak
      wrote on last edited by
      #2

      Change the OpenMode.Output to OpenMode.Append. RageInTheMachine9532

      B 1 Reply Last reply
      0
      • D Dave Kreskowiak

        Change the OpenMode.Output to OpenMode.Append. RageInTheMachine9532

        B Offline
        B Offline
        Bondtje
        wrote on last edited by
        #3

        :-O Thanks a lot. It works

        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