Environment: win2003 + vs2003 +. NET Framework SP1
According to msdn, The listview has selectedindexcollection class,
Available
Listview. selectedindexcollection Indexes =
This . Listview1.selectedindices;
But in vs2003, after the listview. Is input, there is no selectedindexcollection prompt;
If system. Windows. Forms. listview. selectedindexcollection A = listview1.selectedindices; is compiled, but vs2003 does not prompt the selectedindexcollection class.
Use reflector to view listview. The selectedindexcollection class exists and is defined as follows:
Public Class Selectedindexcollection: ilist, icollection, ienumerable
{
// Methods
Public Selectedindexcollection (listview owner );
Public Bool Contains ( Int Selectedindex );
Public Void Copyto (array DEST, Int Index );
Public Ienumerator getenumerator ();
Public Int Indexof ( Int Selectedindex );
Bool Icollection. get_issynchronized ();
Object Icollection. get_syncroot ();
Int Ilist. Add ( Object Value );
Void Ilist. Clear ();
Bool Ilist. Contains ( Object Selectedindex );
Bool Ilist. get_isfixedsize ();
Object Ilist. get_item ( Int Index );
Int Ilist. indexof ( Object Selectedindex );
Void Ilist. insert ( Int Index, Object Value );
Void Ilist. Remove ( Object Value );
Void Ilist. removeat ( Int Index );
Void Ilist. set_item ( Int Index, Object Value );
// Properties
[Browsable ( False )]
Public Int Count {Get;}
Private Int [] Indicesarray {Get;}
Public Bool Isreadonly {Get;}
Public Int This [ Int Index] {Get;}
// Fields
Private Listview owner;
}
Note: subclass calls in a class are called using the class name, which is similar to static methods in the call class. So use
System. Windows. Forms. listview. selectedindexcollection = Listview1.selectedindices
Only a bug exists in the Chinese version of vs2003 and does not prompt that selectedindexcollection exists. For people like me who use vs2003 and like it, beware of thinking inertia and trust Microsoft too much.
Everything requires hands-on verification. You only need to think about misunderstandings. Note: "You have to get a glimpse of it on the paper. You must know that this is the case ".
It seems that it is good to manually compile the source code using a text-based editor.