J
Jesper, Denmark
Hi,,
I've have a problem using the ListViewItem.Selected property.
Let's say that Items[2] has been selected using the mouse on the control.
If I then invoke some code doing this
listView.Items[5].Selected = true;
its as if this 'message' does not proporgate to all corners of the control.
The items[5] item will turn blue alrigth (indicating it has been selected)
and will also (as expected) be the only one that occurs in
listView.SelectedItems.
However.. if I press e.g. arrow up on the keyboard (while the control is in
focus), the selected item will be the one above items[2] i.e. items[1] and
not items[4] as I would expect.
I read on msdn that its important to set the call the controls Focus()
procedure (as below)before using ListViewItem.Selected, but it doesn't help.
ListView1.Focus();
ListView1.Items[0].Selected = true;
Also, If I use the above syntax to select a listviewitem, the control will
not automatically scroll to the location as it would using the up and down
arrow or mouse.
Is there a function that I need to call in order to make the control behave
in the same way wether I'm clicking on the 3rd listviewitem or invoke
ListView1.Items[2].Selected = true;
?????
I would realy appreciate any help on this issue, thank you.
Jesper.
I've have a problem using the ListViewItem.Selected property.
Let's say that Items[2] has been selected using the mouse on the control.
If I then invoke some code doing this
listView.Items[5].Selected = true;
its as if this 'message' does not proporgate to all corners of the control.
The items[5] item will turn blue alrigth (indicating it has been selected)
and will also (as expected) be the only one that occurs in
listView.SelectedItems.
However.. if I press e.g. arrow up on the keyboard (while the control is in
focus), the selected item will be the one above items[2] i.e. items[1] and
not items[4] as I would expect.
I read on msdn that its important to set the call the controls Focus()
procedure (as below)before using ListViewItem.Selected, but it doesn't help.
ListView1.Focus();
ListView1.Items[0].Selected = true;
Also, If I use the above syntax to select a listviewitem, the control will
not automatically scroll to the location as it would using the up and down
arrow or mouse.
Is there a function that I need to call in order to make the control behave
in the same way wether I'm clicking on the 3rd listviewitem or invoke
ListView1.Items[2].Selected = true;
?????
I would realy appreciate any help on this issue, thank you.
Jesper.