Okay this is what I have so far, and I cannot get it to work:
Private Sub FirstCharButton_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles FirstCharButton.Click
Dim oDialog As New OpenFileDialog
Dim sReader As IO.StreamReader /// to open the file for reading
Dim sWriter As IO.StreamWriter /// to write to the file
Dim strText, strPath As String
Dim intCount As Integer
With oDialog
.InitialDirectory = "C:\"
.Filter = "textfiles| *.txt"
If .ShowDialog = DialogResult.OK Then
sReader = New IO.StreamReader(New IO.FileStream(.FileName, IO.FileMode.Open))
While Not sReader.Peek = -1
strText += sReader.ReadLine.Remove(0, 1) & Environment.NewLine /// append each line of the fiels text Minus the firt character to a string buffer
End While
sReader.Close() ///Close the opened file
sWriter = New IO.StreamWriter(.FileName, False) /// False will overwrite the existing file
sWriter.Write(strText)
sWriter.Close()
Do
strText = sReader.ReadLine()
intCount += 1
sWriter.WriteLine(strText)
If intCount Mod 3 = 0 Then
sWriter.WriteLine()
End If
Loop Until strText = ""
End If
End With
End Sub
Also, Is there a way for me to get the count of the first character of the first line and say store it in a intNum Variable, before the code writes the lines back into the file?
Thanks, Chester