add columns from outside string into text file
CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums
Results 1 to 2 of 2

Thread: add columns from outside string into text file

  1. #1
    Join Date
    Mar 2013

    Question add columns from outside string into text file

    hi guys.
    I'm new in VB and I have some text file (F:\path\Boeing747\Lufthansa.txt) consist of data as below:

    2013-03-01 00:05:01|Florence
    2013-03-01 00:20:01|Tokyo
    2013-03-01 00:35:01|Oslo
    2013-03-01 00:40:01|Los Angeles

    is there any code that I can use to add more columns so that the data would be looked like below:

    2013-03-01 00:05:01|Lufthansa|Boeing747|Florence
    2013-03-01 00:20:01|Lufthansa|Boeing747|Tokyo
    2013-03-01 00:35:01|Lufthansa|Boeing747|Oslo
    2013-03-01 00:40:01|Lufthansa|Boeing747|Los Angeles

    kindly need your advice.

  2. #2
    DataMiser is offline Super Moderator Power Poster
    Join Date
    Jul 2008

    Re: add columns from outside string into text file

    You would need to read the file into your program, probably one line at a time using the Line Input # method then make changes to the data from that line and then write it out to a new file using the Print # method. You would do this in a loop to process every line then once you are done close the files and if desired use Kill to delete the original file and Name to rename the new file.
    Always use [code][/code] tags when posting code.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Azure Activities Information Page

Windows Mobile Development Center

Click Here to Expand Forum to Full Width

This is a CodeGuru survey question.


HTML5 Development Center