salut a tous
je trouve cette code dans vbfrance , cette code defini comment remplit une listeview a partire d'une fichier texte , mais je ne comprend pas
j'utilise une listeview avec form1 mais ne finctionne rien , aide moi pour comprendre cette code
Public Sub FillListViewFromFile(oLV As ListView, ByVal sPath As String, Optional ByVal sColumnsSepar As String = vbTab, Optional ByVal sRowsSepar As String = vbCrLf)
' nécessite "Microsoft Windows Common Controls 6.0 (SP6)"
' récupère le tableau du fichier
Dim aRows() As String
Call GetArrayFile(sPath, aRows, sRowsSepar)
With oLV
.Visible = False
' tableau rempli?
If Not IsArrayNull(aRows) Then
Dim i As Integer, j As Integer, aCols() As String, Litem As ListItem
' clear
.ListItems.Clear: .ColumnHeaders.Clear
For i = 0 To UBound(aRows)
aCols = Split(aRows(i), sColumnsSepar)
If i = 0 Then
' header
For j = 0 To UBound(aCols)
.ColumnHeaders.Add , , RightFromChar(aCols(j), ":")
.ColumnHeaders.Item(j + 1).Width = Val(LeftToChar(aCols(j), ":"))
Next j
Else
' cellules
Set Litem = .ListItems.Add(, , aCols(0))
For j = 1 To UBound(aCols)
Litem.SubItems(j) = IIf(LenB(aCols(j)) > 0, aCols(j), vbNullString)
Next j
End If
Erase aCols
Set Litem = Nothing
Next i
Erase aRows
End If
.Visible = True
End With
End Sub