Windows Dev Center

Information
The topic you requested is included in another documentation set. For convenience, it's displayed below. Choose Switch to see the topic in its original location.

ListView.SearchForVirtualItem Event

Occurs when the ListView is in virtual mode and a search is taking place.

Namespace: System.Windows.Forms
Assembly: System.Windows.Forms (in system.windows.forms.dll)

public event SearchForVirtualItemEventHandler SearchForVirtualItem
/** @event */
public void add_SearchForVirtualItem (SearchForVirtualItemEventHandler value)

/** @event */
public void remove_SearchForVirtualItem (SearchForVirtualItemEventHandler value)

In JScript, you can handle the events defined by a class, but you cannot define your own.
Not applicable.

This event occurs when a ListView is in virtual mode and the FindNearestItem or FindItemWithText method is called. When handling this event, you should calculate which item from the list of items supplied by the Items property matches the search criteria and set the SearchForVirtualItemEventArgs.Index property to the index of the ListViewItem. If an item is not provided, FindNearestItem and FindItemWithText will return a null reference (Nothing in Visual Basic).

For more information about handling events, see Consuming Events.

The following code example demonstrates the use of this member. In the example, a search returns the nearest match to a specified integer in a list of the first ten thousand squares. This code example is part of a larger example provided for the VirtualMode property.

Windows 98, Windows Server 2000 SP4, Windows CE, Windows Millennium Edition, Windows Mobile for Pocket PC, Windows Mobile for Smartphone, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition

The Microsoft .NET Framework 3.0 is supported on Windows Vista, Microsoft Windows XP SP2, and Windows Server 2003 SP1.

.NET Framework

Supported in: 3.0, 2.0

Community Additions

Show:
© 2015 Microsoft