05-19-2023 06:16 AM
Hello,
I would like to select, by script, all the items in a list when I click the button "select all". Is there a way to do that?
The MultiSelection option is enabled.
I tried that code with Selection, or MultiSelection, but it doesn't do what I want. The selection option always select the last element of the list. The MultiSelection option doesn't do anything.
Sub SelectAllButton_EventClick(ByRef This) 'Created Event Handler
Dim ListIdx
For ListIdx = 1 To MyList.Items.Count
MyList.Selection(ListIdx)
' MyList.MultiSelection(ListIdx)
Next
End Sub
Thank you,
Jacques
Solved! Go to Solution.
05-22-2023 10:34 AM
' This should do it
Sub Select_All_EventClick(ByRef This) 'Created Event Handler
Call ListBox1.MultiSelection().AddSelection(1,0)
End Sub
' To verify, have a separate button to show what is selected
Sub Show_Selected_EventClick(ByRef This) 'Created Event Handler
Dim i
For i = 1 To ListBox1.MultiSelection.Count
Call MsgBoxDisp(ListBox1.MultiSelection(i).Text)
Next
End Sub
05-22-2023 12:31 PM - edited 05-22-2023 12:31 PM
Perfect, that's exactly what I needed! Thanks!