vik33
10 years agoOccasional Contributor
UserForms- TcxListBox Question
Hi , This might be a simple task but i am having hard time selecting all items of TcxListBox at run time if a user checks on the checkbox (that says, check all items). I am having hardtime to make...
- 10 years ago
I did not see a method for it, and this is kind of sloppy looking by the way the control draws, but it is one way of handling it.
Where List_XLS would be your userform, and lstXLS would be your TcxListBox, and chkAll would be your checkbox with the OnClick handler of function "checkedall":
function checkedall(sender) { /* make sure multiselect is enabled */ UserForms.List_XLS.lstXLS.MultiSelect = true; /* if checked then set selected of each item in the listbox */ if (UserForms.List_XLS.chkAll.Checked){ for (var c = 0; c < UserForms.List_XLS.lstXLS.Items.Count;c++) { UserForms.List_XLS.lstXLS.Selected(c) = true; } } /* if checked then remove selected of each item in the listbox */ if (!UserForms.List_XLS.chkAll.Checked) { for (var c = 0; c < UserForms.List_XLS.lstXLS.Items.Count;c++) { UserForms.List_XLS.lstXLS.Selected(c) = false; } } }