Visual Basic Foro
Programación => Visual Basic 6 => Mensaje iniciado por: E N T E R en Julio 20, 2013, 09:39:48 pm
-
Hola, tengo un ListView que quiero verificar si estan seleccionado en forma correlativo pero siempre respetando desde el 1 el primer item siempre tiene que estar seleccionado.
Tengo este code: que funciona bien si estan en forma correlativo pero no me funciona si están seleccionado total mente.
Private Sub Form_Load()
For i = 1 To 5
ListView1.ListItems.Add , , "Pago " & Format$(i)
Next i
End Sub
Function ContarCheck() As Integer
Dim contar As Integer
contar = 0
For i = 1 To ListView1.ListItems.Count
If ListView1.ListItems(i).Checked = True Then contar = contar + 1
Next i
ContarCheck = contar
End Function
Private Sub cmdCommand1_Click()
If ListView1.ListItems.Count = 0 Then
MsgBox "No existe datos"
Exit Sub
End If
Dim xSelec As Integer
xSelec = ContarCheck
If xSelec = 0 Then
MsgBox "No existe datos seleccionados"
Exit Sub
End If
Dim xV As Integer
xV = 0
For i = 1 To ListView1.ListItems.Count
If xV = xSelec Then
MsgBox "CORRECTO"
Exit For
End If
If ListView1.ListItems(i).Checked = False Then
MsgBox "Debe de estar marcado el item " & " - " & ListView1.ListItems.Item(i)
Exit For
Else
xV = xV + 1
End If
Next i
End Sub
-
Hola, ENTER.
No entendí bien lo que no podés hacer.
¿Lo que querés hacer es verificar si los elementos seleccionados son correlativos en la lista?
Jerónimo
-
Asi mismo, pero ya le pille amigo el
xV = 0
tiene que estar en 1.
Lo que quiero hacer es verificar el orden del check si estan seleccionado en forma correlativo ej:
(http://snag.gy/a1wU5.jpg)
(http://snag.gy/mpRN6.jpg)
(http://snag.gy/r6Xmj.jpg)
Saludos...
-
Me alegro. Perdón por no haber podido ayudar.
Jerónimo