phillip.hess@dot.gov
Member
- Joined
- Nov 9, 2009
- Messages
- 16
- Programming Experience
- Beginner
Greetings
I have a text file that I need to go to column 40 and insert 10 spaces. What appears to happen is it takes the filst line and appends 10 spaces for every line that occurs.
Here is my code:
Private Sub OpenToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles OpenToolStripMenuItem.Click
Dim openFileDialog1 As New OpenFileDialog()
Dim TextLine As String = " "
Dim newTextLine As String = " "
Dim strGap As String = " "
openFileDialog1.InitialDirectory = "C:\Debug\"
OpenFileDialog1.Title = "GEOPAK Report Modifier"
OpenFileDialog1.Filter = "Clearing Limits(*.clr)|*.clr|Seeding(*.ser)|*.ser|Slope Stakes(*.ssb)|*.ser|Text Files(*.txt)|*.txt|XYZ Files(*.xtb)|*.xtb|All Files(*.*)|*.*"
If openFileDialog1.ShowDialog() = System.Windows.Forms.DialogResult.OK Then
Dim objReader As New System.IO.StreamReader(openFileDialog1.FileName)
Do While objReader.Peek <> -1
TextLine = TextLine & objReader.ReadLine() & vbNewLine
If TextLine.Length > 10 Then
TextLine = TextLine.Insert(40, strGap)
End If
Loop
RichTextBoxPrintCtrl1.Font = New Font("Lucida Console", 10, FontStyle.Regular)
RichTextBoxPrintCtrl1.Text = TextLine
End If
End Sub
So when its done it would look like this:
TTTTTTTTT TTTTTTTTTTTTTTT
rather than
TTTTTTTTTTTTTTTTTTTT
I've attached the text file I'm working with. Any help would be very much appreciated.
I have a text file that I need to go to column 40 and insert 10 spaces. What appears to happen is it takes the filst line and appends 10 spaces for every line that occurs.
Here is my code:
Private Sub OpenToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles OpenToolStripMenuItem.Click
Dim openFileDialog1 As New OpenFileDialog()
Dim TextLine As String = " "
Dim newTextLine As String = " "
Dim strGap As String = " "
openFileDialog1.InitialDirectory = "C:\Debug\"
OpenFileDialog1.Title = "GEOPAK Report Modifier"
OpenFileDialog1.Filter = "Clearing Limits(*.clr)|*.clr|Seeding(*.ser)|*.ser|Slope Stakes(*.ssb)|*.ser|Text Files(*.txt)|*.txt|XYZ Files(*.xtb)|*.xtb|All Files(*.*)|*.*"
If openFileDialog1.ShowDialog() = System.Windows.Forms.DialogResult.OK Then
Dim objReader As New System.IO.StreamReader(openFileDialog1.FileName)
Do While objReader.Peek <> -1
TextLine = TextLine & objReader.ReadLine() & vbNewLine
If TextLine.Length > 10 Then
TextLine = TextLine.Insert(40, strGap)
End If
Loop
RichTextBoxPrintCtrl1.Font = New Font("Lucida Console", 10, FontStyle.Regular)
RichTextBoxPrintCtrl1.Text = TextLine
End If
End Sub
So when its done it would look like this:
TTTTTTTTT TTTTTTTTTTTTTTT
rather than
TTTTTTTTTTTTTTTTTTTT
I've attached the text file I'm working with. Any help would be very much appreciated.