Ma listview affiche les données sur trois colonnes
beegeezzz
Messages postés152Date d'inscriptionmardi 4 novembre 2008StatutMembreDernière intervention10 avril 2017
-
21 mai 2009 à 19:34
Renfield
Messages postés17287Date d'inscriptionmercredi 2 janvier 2002StatutModérateurDernière intervention27 septembre 2021
-
21 mai 2009 à 21:22
Bonjour tout le monde,
J'ai utilisé le code que nous avons appris en classe pour la création d'une listview, voici ce code :
Public Sub RemplirListe(ByRef Ctrl As Control, ByRef Tableau As Variant)
Dim Indice As Integer, Indice1 As Integer, Indice2 As Integer
Dim iCol As Integer, i As Integer
If (TypeOf Ctrl Is ComboBox) Or (TypeOf Ctrl Is ListBox) Then
Ctrl.Clear
If IsArray(Tableau) Then
Indice1 = LBound(Tableau)
Indice2 = UBound(Tableau)
End If
Indice1 = LBound(Tableau)
Indice2 = UBound(Tableau)
For Indice = Indice1 To Indice2
Ctrl.AddItem "" & Tableau(Indice)
Ctrl.ItemData(Ctrl.NewIndex) = Indice
Next Indice
ElseIf (TypeOf Ctrl Is ListView) Then
Ctrl.ListItems.Clear
If IsArray(Tableau) Then
Indice1 = LBound(Tableau)
Indice2 = UBound(Tableau)
End If
Indice1 = LBound(Tableau)
Indice2 = UBound(Tableau)
For Indice = Indice1 To Indice2
With Ctrl.ListItems.Add
.Tag = Indice
If Not IsArray(Tableau(Indice)) Then
.Text = "" & Tableau(Indice)
Else
iCol = 0
For i = LBound(Tableau(Indice)) To UBound(Tableau(Indice))
If iCol = 0 Then
.Text = "" & Tableau(Indice)(i)
Else
.SubItems(iCol) = "" & Tableau(Indice)(i)
End If
iCol = iCol + 1
If iCol > Ctrl.ColumnHeaders.Count Then Exit For
Next i
End If
End With
Next Indice
End If
End Sub
Je me demandais pourquoi il créait d'office trois colonnes ?
Le code classe donc le nom des crus sur trois colonnes, comment est-il possible de dire :
Colonne 1 : info A
Colonne 2 : info B
Colonne 3 : info C
Merci d'avance pour l'aide.
beegees
A voir également:
Ma listview affiche les données sur trois colonnes