ListView SelectedItems

  • Thread starter Thread starter Berryl Hesh
  • Start date Start date
B

Berryl Hesh

I'm setting the second item on the listView programmatically, this way:
_listView_Items.Items[0].Selected=true

I'm expected _listView.SelectedItems.Count to be > zero after that point,
but it is zero. The debugger confirms the 1st item's Selected property is
indeed true. Can you see what I'm doing wrong?

Thanks for sharing. BH
 
Hi,

It seems that adding an item to teh selecteditems list, makes it seleccted
but not the reverse.
 
It turned out that the solution was to create a windows Handle, which I did
with CreateControl(). A running windows form would have done that for me,
but I was testing a wrapper for the control so I needed to do it myself.

Thanks,
BH

Aflava said:
Hi,

It seems that adding an item to teh selecteditems list, makes it seleccted
but not the reverse.


--
Aflava
Windows Forms Components
http://www.aflava.com


Berryl Hesh said:
I'm setting the second item on the listView programmatically, this way:
_listView_Items.Items[0].Selected=true

I'm expected _listView.SelectedItems.Count to be > zero after that point,
but it is zero. The debugger confirms the 1st item's Selected property is
indeed true. Can you see what I'm doing wrong?

Thanks for sharing. BH
 

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

Similar Threads

race condition? 3
ContextMenuStrip and Listview 3
listView 1
Problem with images in ListView 1
ListView selection 8
How to select first row in the listview control 3
Listview 1
Activating tab Pages 2

Back
Top