CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 3 of 3
  1. #1
    Join Date
    Dec 2000
    Location
    chennai,India
    Posts
    33

    Merging 2 Text files

    Hi,

    I want to merge 2 text files into a single one through VB. Please help me out.
    Thanks in Advance

    Regards,
    Bala


  2. #2
    Join Date
    May 1999
    Location
    Omika, Japan
    Posts
    729

    Re: Merging 2 Text files


    1. Read both into seperate buffers and concatenate them and print again. You can have a different name for the new file, if you wish

    or
    2. Read the secong file into a buffer. Open the first file in append mode and write the buffer. The first file will be updated with the contents
    or do the same for the 2nd file!

    You want the logic or code?!

    RK

  3. #3
    Join Date
    May 2000
    Location
    New York, NY, USA
    Posts
    2,878

    Re: Merging 2 Text files

    Private Sub Command1_Click()
    Dim filename1 As String
    Dim filename2 As String
    Dim filename3 As String

    filename1 = "c:\config.sys"
    filename2 = "c:\autoexec.bat"
    filename3 = "c:\allfiles.txt"
    Shell "c:\command.com /c copy " & filename1 & " + " & filename2 & " " & filename3, vbHide
    End Sub

    Iouri Boutchkine
    iouri@hotsheet.com
    Iouri Boutchkine
    iouri@hotsheet.NOSPAM.com

Posting Permissions

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





Click Here to Expand Forum to Full Width

Featured