Update status of "select all" checkbox

C

celinesuzzarini

Hi All,

I currently have a multiselect list box and a check box.
When the check box is checked, it selects everything I have in the list
box.
Now, if I deselect a few items in the list box, then the check box
should be unchecked... and if I manually reselect everything, then the
check box should be checked.
Is there any way to do it without have to check every item in the list
(kind of slow)?

Thanks,
Celine
 
G

Guest

How about a Select All command button?
In the click event, programmatically make every item in the list selected?

Here is a procedure you can use that will select all items or clear all
items. Make "Select All" the Caption property in Design view of the form so
it will start in the correct place.

Public Sub SelAll()
Dim lngCtr As Long
Dim blnSelectAll As Boolean

blnSelectAll = Me.CmdSelect.Caption = "Select All"
For lngCtr = 0 To Me.lstBillProdOffering.ListCount - 1
Me.lstBillProdOffering.Selected(lngCtr) = blnSelectAll
Next lngCtr
Me.CmdSelect.Caption = IIf(blnSelectAll, "Clear All", "Select All")
End Sub
 
C

celinesuzzarini

OK, that's really smart!! lol!! I didn't even think about it!! I was so
much into my check box!

Thanks!
Celine
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top