title: Extracting specific lines from one text file to other text file
body: <p>I want to extract some specific lines from a text file to other text file. i am using the following code </p>
  
  <pre><code>    Imports System.IO
  
  
  
  Public Class Form1
  
      Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
  
          Dim Tr As IO.TextReader = System.IO.File.OpenText("C:\Assignment.txt")
          For c As Integer = 1 To 10
  
              If c = 7 Then
                  Dim MyFileLine As String = Split(Tr.ReadToEnd(), vbCrLf)(c) &amp; vbCrLf
                  Tr.Close()
  
  
  
                  Dim TW As System.IO.TextWriter
                  'Create a Text file and load it into the TextWriter 
                  TW = System.IO.File.CreateText("C:\Assignment1.txt")
                  TW.WriteLine(MyFileLine)
                  'Flush the text to the file 
                  TW.Flush()
                  'Close the File 
                  TW.Close()
              End If
  
          Next c
      End Sub
  End Class
  </code></pre>
  
  <p>But this code extract only the line no 7 where i want to extract the 8th,9th,10th,14th,15th,16th, lines also . Please guide me the right solution. Thank u in advance.</p>