Read and fille listBox from txt file

i use two listbox, not elegant idea … right now it is solution.
2listBox

Be back there tomorrow and you will be able to set it into a single ListBox.

Sometimes eye and brain do not match.

Cheers

Back home (less light = better view).

Try the following code:

  Dim i As Integer
  Dim Loc_Row As Integer
  
  // Alignment and Editable
  LBCompas.ColumnAlignment(0) = ListBox.AlignCenter
  LBCompas.ColumnAlignment(1) = ListBox.AlignRight
  LBCompas.ColumnType(1)      = ListBox.TypeEditable
  
  // Fill the ListBox
  LBCompas.columncount  = 2
  LBCompas.columnwidths = "45%,55%"
  LBCompas.HasHeading   = True
  LBCompas.heading(0)   = "CC"
  LBCompas.heading(1)   = " dev "
  
  // Text File Reading
  Dim f As FolderItem = GetOpenFolderItem("text") // as defined in File Type Sets Editor
  If f <> Nil Then
    If f.Exists Then
      // Be aware that TextInputStream.Open coud raise an exception
      Dim Item_TIS As TextInputStream
      Try
        Item_TIS = TextInputStream.Open(f)
        Item_TIS.Encoding = Encodings.UTF8
        
        // Loop to add data
        For i = 0 To 360 Step 15
          LBCompas.AddRow(Format(i,"000")+"°")
          Loc_Row = LBCompas.LastIndex
          LBCompas.Cell(Loc_Row, 1) = Item_TIS.ReadLine
        Next
        
      Catch e As IOException
        Item_TIS.Close
        MsgBox("Error accessing file.")
      End Try
    End If
  End If

Works fine here.