Hi CJL,
I performed a test based on your description but I didn't reproduce the
problem.
I set up a Windows application project and drag&drop a ListView from
Toolbox onto the form. I set the VirtualMode property of the listview to
true and the VirtualListSize property to 10 and handle the
RetrieveVirtualItem event of the listview. I add a button on the form to
show the selected indices. The following is the code in the form.
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
this.listView1.RetrieveVirtualItem += new
RetrieveVirtualItemEventHandler(listView1_RetrieveVirtualItem);
}
void listView1_RetrieveVirtualItem(object sender,
RetrieveVirtualItemEventArgs e)
{
ListViewItem item = new ListViewItem(e.ItemIndex.ToString());
e.Item = item;
}
private void button1_Click(object sender, EventArgs e)
{
MessageBox.Show("SelectedIndices: " +
this.listView1.SelectedIndices.Count.ToString());
for (int i = 0; i < this.listView1.SelectedIndices.Count; i++)
{
MessageBox.Show(this.listView1.SelectedIndices
.ToString());
}
}
}
Build the project and run it. If I select 3 items using Shift key in the
listview and click the button on the form, a message box pops up saying
'SelectedIndices: 3' firstly and three message boxes show up consequently
and each of them says the index of each selected item.
Is there any difference between your project and mine? If yes, you may show
me some sample code or send me your project that could just reproduce the
problem. To get my actual email address, remove the 'online' from my
displayed email address.
I look forward to your reply.
Sincerely,
Linda Liu
Microsoft Online Community Support
==================================================
Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/subscriptions/managednewsgroups/default.aspx#notif
ications.
Note: The MSDN Managed Newsgroup support offering is for non-urgent issues
where an initial response from the community or a Microsoft Support
Engineer within 1 business day is acceptable. Please note that each follow
up response may take approximately 2 business days as the support
professional working with you may need further investigation to reach the
most efficient resolution. The offering is not appropriate for situations
that require urgent, real-time or phone-based interactions or complex
project analysis and dump analysis issues. Issues of this nature are best
handled working with a dedicated Microsoft Support Engineer by contacting
Microsoft Customer Support Services (CSS) at
http://msdn.microsoft.com/subscriptions/support/default.aspx.
==================================================
This posting is provided "AS IS" with no warranties, and confers no rights.