[RESOLVED] Text File Columns
Ive been trying to use the "ControlChars.Tab" to sort the strings into columns with code from this forum.
Code:
Public Sub save()
'http://www.vbforums.com/showthread.php?t=366421&highlight=listview+textfile
Try
Dim sw As New IO.StreamWriter("C:\StickFrameExpress\Jobs\" & Me.lblJobNumber.Text & ".txt", True)
'header
sw.WriteLine("Component Name, Material Type, Length, Quanitiy, Units, NOTE:")
Dim i As Int16
With Me.ListView1
For i = 0 To CShort(.Items.Count - 1)
If .Items(i).Text <> "" Then
sw.WriteLine(.Items(i).Text & _
ControlChars.Tab & _
ControlChars.Tab & .Items(i).SubItems(1).Text & _
ControlChars.Tab & _
ControlChars.Tab & .Items(i).SubItems(2).Text & _
ControlChars.Tab & _
ControlChars.Tab & .Items(i).SubItems(3).Text & _
ControlChars.Tab & _
ControlChars.Tab & .Items(i).SubItems(4).Text & _
ControlChars.Tab & _
ControlChars.Tab & .Items(i).SubItems(5).Text)
End If
Next
End With
sw.Close()
Me.ListView1.Clear()
Catch ex As Exception
End Try
End Sub
I tried using "ControlChars.Tab" multibly times but as the individual string change in size the column do not line up.
http://img204.imageshack.us/img204/2433/txtfileeo3.jpg
Should i been working with "ControlChars.Tab" for this or something else?
cheers
toe
Re: [RESOLVED] Text File Columns
Finally I did some good today. You are welcome!