?
Solved

VB6 - Listbox with checked items

Posted on 2013-05-17
1
Medium Priority
?
508 Views
Last Modified: 2013-05-17
Hi guys,

I have a listbox with property style=1 (checked boxes), the problem is when i read it in a loop, it reads the selected ones instead of the checked ones.

Is the any way to read only the checked ones?

Thank you in advance,

CODE:

Private Sub cmdCalculadora_Click()
    Dim i As Long
    Dim nInv As Integer
 
    For i = 0 To lstCriterios.ListCount - 1
        If lstCriterios.Selected(i) = True Then
            If Right(lstCriterios.Text, 1) <> "*" Then
                nInv = Right(lstCriterios.Text, 3)
                npNumerodeInvitados = (npNumerodeInvitados + nInv)
            End If
            npNumerodeSeleccionados = (npNumerodeSeleccionados + 1)
        End If
    Next i
   
    npNumerodeSeleccionadosMasInvitados = (npNumerodeSeleccionados + npNumerodeInvitados)
    txtSeleccionados.Text = npNumerodeSeleccionados
    txtInvitados.Text = npNumerodeInvitados
    txtSeleccionadosMasInvitados.Text = npNumerodeSeleccionadosMasInvitados
End Sub
0
Comment
Question by:elm9999
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
1 Comment
 

Accepted Solution

by:
elm9999 earned 0 total points
ID: 39176077
Alredy done by myself.
0

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

If you have ever used Microsoft Word then you know that it has a good spell checker and it may have occurred to you that the ability to check spelling might be a nice piece of functionality to add to certain applications of yours. Well the code that…
Since upgrading to Office 2013 or higher installing the Smart Indenter addin will fail. This article will explain how to install it so it will work regardless of the Office version installed.
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…
Suggested Courses
Course of the Month10 days, 15 hours left to enroll

770 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question