Hi programmers:
Version: Visual Basic 6.0
I need help with a listbox which Style is 1-checkbox. when the program opens the listbox gets
populated by 50 states. I have three buttons:
1- to select and unselect one more states
2- Select All - to check or select all states
3- Unselect All - to uncheck or unselect all checkboxes
Note:
Case 1:
If I run the program by opening it throughtout Microsoft Visual Basic the program runs without no
problem.
Case2:
If I compile the program and I make it an executable, the program does:
-- populate the listbox wiht the 50 states names
-- I able to select one state and process
-- I am not able to execute multiple selections
-- I am not able to use the SELECT ALL or UNSELECT ALL because the program cancel and close
completed.
Could you please tell me what I am doing wrong.
Thanks all for your time.
Daniel
Florida
===========================================
Here is the code for for the three buttons:
Private Sub SelectState_Click()
FromButton = True
ListboxS.Selected(ListboxS.ListIndex) = Not ListboxS.Selected(ListboxS.ListIndex)
End Sub
Private Sub cmdSelectAll_Click()
Dim i As Integer
For i = ListboxS.ListCount - 1 To 0 Step -1
If ListboxS.Selected(i) = False Then
ListboxS.Selected(i) = True
End If
Next i
End Sub
Private Sub cmdUnselectAll_Click()
Dim i As Integer
For i = ListboxS.ListCount - 1 To 0 Step -1
If ListboxS.Selected(i) = True Then
ListboxS.Selected(i) = faalse
End If
Next i
End Sub
Version: Visual Basic 6.0
I need help with a listbox which Style is 1-checkbox. when the program opens the listbox gets
populated by 50 states. I have three buttons:
1- to select and unselect one more states
2- Select All - to check or select all states
3- Unselect All - to uncheck or unselect all checkboxes
Note:
Case 1:
If I run the program by opening it throughtout Microsoft Visual Basic the program runs without no
problem.
Case2:
If I compile the program and I make it an executable, the program does:
-- populate the listbox wiht the 50 states names
-- I able to select one state and process
-- I am not able to execute multiple selections
-- I am not able to use the SELECT ALL or UNSELECT ALL because the program cancel and close
completed.
Could you please tell me what I am doing wrong.
Thanks all for your time.
Daniel
Florida
===========================================
Here is the code for for the three buttons:
Private Sub SelectState_Click()
FromButton = True
ListboxS.Selected(ListboxS.ListIndex) = Not ListboxS.Selected(ListboxS.ListIndex)
End Sub
Private Sub cmdSelectAll_Click()
Dim i As Integer
For i = ListboxS.ListCount - 1 To 0 Step -1
If ListboxS.Selected(i) = False Then
ListboxS.Selected(i) = True
End If
Next i
End Sub
Private Sub cmdUnselectAll_Click()
Dim i As Integer
For i = ListboxS.ListCount - 1 To 0 Step -1
If ListboxS.Selected(i) = True Then
ListboxS.Selected(i) = faalse
End If
Next i
End Sub