On 04/24/2011 12:34 AM, kalle wrote:
On 24 Apr, 06:12, wrote:
I forgot to tell you that the solution given before is ok if the MultiSelect property = fmMultiSelectMulti
--
isabelle
Le 2011-04-23 23:48, isabelle a écrit :
hi,
Code:
Private Sub ListBox1_Change()
Dim i As Integer, n As Integer
For i = 0 To ListBox1.ListCount - 1
If ListBox1.Selected(i) = True Then n = n + 1
Next i
If n x Then
x = x + 1
MsgBox "select"
Else
x = x - 1
MsgBox "deselect"
End If
End Sub
- Dölj citerad text -
- Visa citerad text -
Hi Isabelle,
Thanks for your code. I have problems to figure it out. Seemes to work
för the
last selected item in the list but not if there are several selections
and one is
deselected. Is not the value for x set at all?
Brgds
CG Rosén
Would it work to keep the total number of selected items in a static
variable, and then you just count the selected items and compare it to
the previous total in each click event, then update the total to the
current number?