Click here to Skip to main content
15,886,362 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
to select only one element I wrote:

m_listbox.SetCurSel(i);


What I have tried:

I used setCurSel also to select more elements..but it doesn't work
Posted
Updated 24-Feb-20 0:12am

1 solution

 
Share this answer
 
Comments
Member 14594285 24-Feb-20 6:18am    
I used:
m_listbox.SelItemRange(TRUE, 0, m_listbox.GetCount());

but how must I write to set multiple selection?
CPallini 24-Feb-20 6:30am    
You should remove the LVS_SINGLESEL from the listbox window stile.
(You can do it also programmatically, using ModifyStyle).
Note, the last item has index
m_listbox.GetCount()-1
Member 14594285 24-Feb-20 8:16am    
yes but I want to do run_time..how must I write?
Member 14594285 24-Feb-20 8:29am    
I wrote: m_listbox.ModifyStyle(LVS_SINGLESEL, NULL, 0);

but if in resource I set singleselect I can't modifie..this row doesn't work

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900