Results 1 to 3 of 3

Thread: [2008]Reading lines from one text file and write it out to another text file

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Nov 2008
    Posts
    68

    [2008]Reading lines from one text file and write it out to another text file

    Hi.

    I need to read from one text file and then write it out to another text file.

    IE.

    Read the all the lines in file 'HCR.tmp' and write all the line from 'HCR.tmp' to 'HIVECLS.inf'

    Here is the code i have been trying to use put im getting a problem with 'LINES' in bold.
    Im getting Value of type '1-dimensional array of string' cannot be converted to 'string' error


    Code:
    Private Sub HiveCls() 
    
            Dim lines() As String = IO.File.ReadAllText("C:\SFE\Temp\HCR.tmp") 
    
            Dim CLSlines As New List(Of String)(IO.File.ReadAllLines("C:\SFE\Temp\HIVECLS.inf")) 
            For CLSindex As Integer = 0 To CLSlines.Count - 1 
    
                If CLSlines(CLSindex) = "[AddReg]" Then 
                    CLSlines.Insert(CLSindex + 1, lines) 
    
                    Exit For 
                End If 
    
            Next 
    
    
            IO.File.WriteAllLines("C:\SFE\Temp\HIVECLS.inf", CLSlines.ToArray()) 
    
        End Sub
    Many thanks for your help.

    Worf

  2. #2
    Software Carpenter dee-u's Avatar
    Join Date
    Feb 2005
    Location
    Pinas
    Posts
    11,127

    Re: [2008]Reading lines from one text file and write it out to another text file

    This is what MSDN has to say about IO.File.ReadAllText.
    Regards,


    As a gesture of gratitude please consider rating helpful posts. c",)

    Some stuffs: Mouse Hotkey | Compress file using SQL Server! | WPF - Rounded Combobox | WPF - Notify Icon and Balloon | NetVerser - a WPF chatting system

  3. #3

    Thread Starter
    Lively Member
    Join Date
    Nov 2008
    Posts
    68

    Re: [2008]Reading lines from one text file and write it out to another text file

    Thank you, will have a look.

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