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. aaaahhhhhhhhh copy and pasting and reading and writing in txt documents

aaaahhhhhhhhh copy and pasting and reading and writing in txt documents

Scheduled Pinned Locked Moved Visual Basic
helpcsharpquestion
3 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.
  • O Offline
    O Offline
    offroaderdan
    wrote on last edited by
    #1

    HEllo, I depretly need someones help, i am using vb.net and have nearly finished a program all i need to do is basically clear data in a txt document after reading it e.g hello.txt i am using

    Dim objReader As New System.IO.StreamReader(FILE_NAME)

    where i have dimed the FILE_NAME as string ("hello.txt") however i then added

    Dim objwriter As New System.IO.Streamwriter(FILE_NAME)

    and tried objwriter.writeline("") which then came up with an error message saying file currently in use. Is there no way that you can read the file and then write data into i????? If anybody can help me that would be very good Thanks Dan

    D J 2 Replies Last reply
    0
    • O offroaderdan

      HEllo, I depretly need someones help, i am using vb.net and have nearly finished a program all i need to do is basically clear data in a txt document after reading it e.g hello.txt i am using

      Dim objReader As New System.IO.StreamReader(FILE_NAME)

      where i have dimed the FILE_NAME as string ("hello.txt") however i then added

      Dim objwriter As New System.IO.Streamwriter(FILE_NAME)

      and tried objwriter.writeline("") which then came up with an error message saying file currently in use. Is there no way that you can read the file and then write data into i????? If anybody can help me that would be very good Thanks Dan

      D Offline
      D Offline
      dan sh
      wrote on last edited by
      #2

      AFAIK you can't edit a file. You will need to recreate it.

      It's not necessary to be so stupid, either, but people manage it. - Christian Graus, 2009 AD

      1 Reply Last reply
      0
      • O offroaderdan

        HEllo, I depretly need someones help, i am using vb.net and have nearly finished a program all i need to do is basically clear data in a txt document after reading it e.g hello.txt i am using

        Dim objReader As New System.IO.StreamReader(FILE_NAME)

        where i have dimed the FILE_NAME as string ("hello.txt") however i then added

        Dim objwriter As New System.IO.Streamwriter(FILE_NAME)

        and tried objwriter.writeline("") which then came up with an error message saying file currently in use. Is there no way that you can read the file and then write data into i????? If anybody can help me that would be very good Thanks Dan

        J Offline
        J Offline
        John M Bundy
        wrote on last edited by
        #3

        you have to close the reader before opening the writer. objReader.Close()

        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