Synchroniser 3 listbox

guillaume massart - 31 juil. 2001 à 15:48
farradjs Messages postés 73 Date d'inscription lundi 17 novembre 2003 Statut Membre Dernière intervention 16 mars 2009 - 24 janv. 2005 à 21:56
est t'il possible de synchroniser 3 listbox
cad ynchronser les sroll bar

merci d'avance c important pour mon projet

merci d'avance

cordialement

guillaume massart

1 réponse

farradjs Messages postés 73 Date d'inscription lundi 17 novembre 2003 Statut Membre Dernière intervention 16 mars 2009
24 janv. 2005 à 21:56
c'est simple il faut utiliser la propriété topindex du listbox
voici un ptit prog pour synchroniser 2 listbox tu peux le faire pour n listbox.
cré une form ajoute 2 listbox et timer tu peux cacher les scrollbar en mettan l'un sur l'autre a+

Dim focus1 As Boolean
Dim focus2 As Boolean



Private Sub Form_Load()
For i = 1 To 50


List1.AddItem i
List2.AddItem i * 10


Next
End Sub






Private Sub List1_GotFocus()
focus1 = True
End Sub


Private Sub List1_LostFocus()


focus1 = False


End Sub


Private Sub List2_GotFocus()
focus2 = True
End Sub


Private Sub List2_LostFocus()


focus2 = False


End Sub



Private Sub List1_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
List2.ListIndex = List1.ListIndex


End Sub
Private Sub List2_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)


List1.ListIndex = List2.ListIndex


End Sub


Private Sub Timer1_Timer()






If focus1 = True Then


List2.TopIndex = List1.TopIndex


End If


If focus2 = True Then


List1.TopIndex = List2.TopIndex
End If


End Sub
0
Rejoignez-nous