Listview Item.Selected not populating Listview.SelectedItems collection

C

Chris Adams

Hi,

I'm having some trouble getting the Listview.Items[0].Selected = true
to populate the SelectedItems collection. The code that I'm using is:

CtrlTransferSettings tester = CtrlTransferSettings()
if (pos < tester.lstStrings.Items.Count)
{
tester.lstStrings.Focus();
tester.lstStrings.Items[0].Selected = true;
tester.lstStrings.Select();
}

What's happening is that the SelectedItems.Count is staying at 0, even
after setting Items[0].Selected to true.

While in debug mode, if I go look at the "Autos" listing and
drill-down to the lstStrings.SelectedItems.Count property it updates
itself and then lists the count as 1 and everything works correctly.
But, it will only update if I drill down the 'autos list' in
debug-mode. If I just run the code, the count always stays at 0.

Is this a bug in the ListView control? Or am I missing a step?

Any help would be greatly appreciated.

Sincerely,
Chris AdamsReply: Remove the online. from the email address before replying
 

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