Im trying to populate Listbox with Columns but I didn't get success. Below is my code. I populated Listbox with text file:
on users.txt:
1|Jhon|street 3|12/03/1985
2|Peter|strt2|29/09/2009
3|Scoby|street 1|11/02/2001
Here is my code to populate , as you can see there's delimiter "|".
Public Sub Pathway(way As Variant) 'SET DATABASE FOLDER
way = App.Path & "\data"
End Sub
Private Sub PopulateListbox()
Call Pathway(way) 'SET FOLDER WAY
List1.Clear
Dim fNum As Integer
Dim sInput As String
Dim iInd As Integer
'- Holds list item information
Dim strList As String
'To load the ListBox from file:
fNum = FreeFile
'List1.Clear
Open way & "\users.txt" For Input As #fNum
Do Until EOF(fNum)
Input #fNum, sInput
'-====================
'- Increment item count
rCT = rCT + 1
'- Resize array to match item count
ReDim Preserve nmInfo(rCT)
'- Add data to the array
nmInfo(rCT) = sInput
'- Use VB string "Replace" function to remove the pipes
strList = Replace(nmInfo(rCT), "|", Space(1))
'- Add to listbox
List1.AddItem strList 'sInput
'-======================
Loop
Close #fNum
End Sub
I would like to ask for your help to add (4) Columns to my Listbox. I tried Listbox property but it didn't work.
Thanks in advance :)