ListView SelectedItems

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
 
A

Aflava

Hi,

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

Berryl Hesh

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

Top