Ive been trying to use the "ControlChars.Tab" to sort the strings into columns with code from this forum.
I tried using "ControlChars.Tab" multibly times but as the individual string change in size the column do not line up.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
Should i been working with "ControlChars.Tab" for this or something else?
cheers
toe





Reply With Quote