Et je voudrais que ca m'affiche dans une textbox par exemple :
salut = 2x
bonjour = 1x
coucou = 4x
tchao = 1x
Voila mon gros soucis !
En sachant que les valeurs de la liste sont très variables donc impossible de lui dire combien de fois tu comptes "coucou" dans la liste mais plutôt faire pour que : combien de fois tu comptes, le premier item de la liste, combien de fois tu comptes le second a condition que celui-ci soit différent du premier item etc....
cs_NoMitsu
Messages postés122Date d'inscriptionlundi 16 décembre 2002StatutMembreDernière intervention15 février 2011 1 juil. 2004 à 23:20
voila ce code marche avec une listbox et une textbox sur une form
Option Explicit
Private Type test
vStr As String
vNbr As Integer
End Type
Private Sub Form_Load()
Dim i As Long, j As Long
Dim Tab_Txt() As test
Dim vExit As Boolean
ReDim Tab_Txt(0)
For i = 0 To List1.ListCount - 1
vExit = False
For j = 0 To UBound(Tab_Txt) If List1.List(i) Tab_Txt(j).vStr Then vExit True: Exit For
Next j
If vExit = False Then
ReDim Preserve Tab_Txt(UBound(Tab_Txt) + 1)
Tab_Txt(UBound(Tab_Txt)).vStr = List1.List(i)
Tab_Txt(UBound(Tab_Txt)).vNbr = 1
For j = i + 1 To List1.ListCount - 1
If List1.List(i) = List1.List(j) Then
Tab_Txt(UBound(Tab_Txt)).vNbr = Tab_Txt(UBound(Tab_Txt)).vNbr + 1
End If
Next j
End If
Next i
For i = 1 To UBound(Tab_Txt) Text1.Text Text1.Text & Tab_Txt(i).vStr & " " & Tab_Txt(i).vNbr & Chr(13) & Chr(10)
Next i
End Sub