RE: HELP! file input/output

  • 19 years ago

    I need to read variables and their values from a file, and enable the user to change them in this big window, and of course save them back to a file. Seems pretty standard, but i don't know how to do it? Anyone help? Is there any code on the web i can copy/take a look at?


    Please email me back at [email protected]
    thanks

  • 19 years ago

    Big window?  I think you need to be slightly more specific.  But hopefully this helps a bit:


    iFile = FreeFile
    Open sFile For Input As #iFile
    x=0
    Do until EOF(iFile)
      Line Input #iFile, sData(x)
      x = x +1
    Loop
    Close #iFile


    Now you have the data in an array.  You can display it however you like to in the big window, and when you want to rewrite the data, you do this:


    iFile = FreeFile
    Open sFile For Output As #iFile
    x=0
    Do Until x = UBound(sData)
      Print #iFile, sData(x)
      x = x + 1
    Loop
    Close #iFile


    Any more questions, click the Visual Basic Button at the top and then go to Tutorials and Tips, then File & Directory perhaps.  Good Luck-

Post a reply

Enter your message below

Sign in or Join us (it's free).

Contribute

Why not write for us? Or you could submit an event or a user group in your area. Alternatively just tell us what you think!

Our tools

We've got automatic conversion tools to convert C# to VB.NET, VB.NET to C#. Also you can compress javascript and compress css and generate sql connection strings.

“Never trust a programmer in a suit.” - Anonymous