- exemple avec 5 listbox list1(0),list1(1),.............
-
- j ai mis les listbox a cheval pour cacher les barres de scroll en trop
-
- voila le code-------------------------------------------------------------------------------------------------------------
-
-
- '---------------------------la routine est dans un timer------------------------------------
- 'le list1(0).tag est a -00002-00002 dans les proprietés
- '-------------------------- ne gere pas le multi liste selection pour le moment-----------------------
-
- '--------------------------remplir les listes----------200 lignes /5 colonnes---------------
- Private Sub Form_Load()
-
- For t = 0 To 200
- For a = 0 To 4
- List1(a).AddItem Str(t) + Str(a) + "<<=="
- Next
- Next
-
- '--------------------------------------------------------------------------------------------
- Timer1.Interval = 100 '<<== ----si comme moi la roulette ne fonctionne pas bien dans en scrolling alors ceci est ma solution--------------------------
-
- End Sub
-
- Private Sub List1_Click(Index As Integer)
- Call Timer1_Timer 'lier les listes
- End Sub
-
-
- Private Sub List1_Scroll(Index As Integer)
- Call Timer1_Timer 'lier les listes
- End Sub
-
- Private Sub List1_Validate(Index As Integer, Cancel As Boolean)
- Call Timer1_Timer 'lier les listes
- End Sub
-
-
- Private Sub Timer1_Timer()
- 'routine --lier les listes--
- 'nombre de colonnes-1
- nc = 4
- '------------------lecture variables---------------------------------------------------
- K_li = Val(Left(List1(0).Tag, 6))
- K_to = Val(Right(List1(0).Tag, 6))
- '------------------valeur listindex <> des autres --------------------------------------
- er = 0
- For t = 0 To nc
- If List1(t).ListIndex <> K_li And List1(t).ListIndex <> -1 Then
- K_li = List1(t).ListIndex
- er = 1: Exit For
- End If
- Next
- '-------------------si <> il y a retablir les autres-------------------------------------
- If er = 1 Then
- For t = 0 To nc
- List1(t).ListIndex = K_li
- Next
- End If
- '-------------------valeur topindex <> des autres----------------------------------------
- er = 0
- For t = 0 To nc
- If List1(t).TopIndex <> K_to Then
- K_to = List1(t).TopIndex
- er = 1: Exit For
- End If
- Next
- '-------------------si <> il y a retablir les autres-------------------------------------
- If er = 1 Then
- For t = 0 To nc
- List1(t).TopIndex = K_to
- Next
- End If
- '-------------------si une active la selection (list1(0) maitre)-------------------------
- If K_li >= 0 Then
- For t = 1 To nc
- List1(t).Selected(K_li) = List1(0).Selected(K_li)
- Next
- End If
- '-------------------sauvegarde les variables----------------------------------------------
- List1(0).Tag = Format(K_li, "+0####")
- List1(0).Tag = List1(0).Tag & Format(K_to, "+0####")
-
- DoEvents
- End Sub
-
exemple avec 5 listbox list1(0),list1(1),.............
j ai mis les listbox a cheval pour cacher les barres de scroll en trop
voila le code-------------------------------------------------------------------------------------------------------------
'---------------------------la routine est dans un timer------------------------------------
'le list1(0).tag est a -00002-00002 dans les proprietés
'-------------------------- ne gere pas le multi liste selection pour le moment-----------------------
'--------------------------remplir les listes----------200 lignes /5 colonnes---------------
Private Sub Form_Load()
For t = 0 To 200
For a = 0 To 4
List1(a).AddItem Str(t) + Str(a) + "<<=="
Next
Next
'--------------------------------------------------------------------------------------------
Timer1.Interval = 100 '<<== ----si comme moi la roulette ne fonctionne pas bien dans en scrolling alors ceci est ma solution--------------------------
End Sub
Private Sub List1_Click(Index As Integer)
Call Timer1_Timer 'lier les listes
End Sub
Private Sub List1_Scroll(Index As Integer)
Call Timer1_Timer 'lier les listes
End Sub
Private Sub List1_Validate(Index As Integer, Cancel As Boolean)
Call Timer1_Timer 'lier les listes
End Sub
Private Sub Timer1_Timer()
'routine --lier les listes--
'nombre de colonnes-1
nc = 4
'------------------lecture variables---------------------------------------------------
K_li = Val(Left(List1(0).Tag, 6))
K_to = Val(Right(List1(0).Tag, 6))
'------------------valeur listindex <> des autres --------------------------------------
er = 0
For t = 0 To nc
If List1(t).ListIndex <> K_li And List1(t).ListIndex <> -1 Then
K_li = List1(t).ListIndex
er = 1: Exit For
End If
Next
'-------------------si <> il y a retablir les autres-------------------------------------
If er = 1 Then
For t = 0 To nc
List1(t).ListIndex = K_li
Next
End If
'-------------------valeur topindex <> des autres----------------------------------------
er = 0
For t = 0 To nc
If List1(t).TopIndex <> K_to Then
K_to = List1(t).TopIndex
er = 1: Exit For
End If
Next
'-------------------si <> il y a retablir les autres-------------------------------------
If er = 1 Then
For t = 0 To nc
List1(t).TopIndex = K_to
Next
End If
'-------------------si une active la selection (list1(0) maitre)-------------------------
If K_li >= 0 Then
For t = 1 To nc
List1(t).Selected(K_li) = List1(0).Selected(K_li)
Next
End If
'-------------------sauvegarde les variables----------------------------------------------
List1(0).Tag = Format(K_li, "+0####")
List1(0).Tag = List1(0).Tag & Format(K_to, "+0####")
DoEvents
End Sub