Article ID: 257495 - View products that this article applies to.
This article was previously published under Q257495
This article has been archived. It is offered "as is" and will no longer be updated.
When you click on an item in a ListView control, the ItemClick event for the ListView control executes twice.
This problem is caused by the way in which manual label editing is implemented. When you select an item, the ItemClick event is fired normally, but, in addition, the ListView control enables a built-in timer whose delay is equal to that of the duration of a double-click. When this delay elapses, the timer's event is triggered and the code for this timer determines if the ListView control should enter the label editing mode. If label editing is aborted, which is always the case for manual label editing, then the selection is cleared and re-selected. This re-selection triggers the second ItemClick.
You can cause this problem to occur in one of two ways. The first is to set the LabelEdit property of ListView to lvwManual (as in the sample code in the "More Information" section of this article). An alternate way of reproducing this behavior is to set the LabelEdit property to lvwAutomatic and set Cancel equal to True in the BeforeLabelEdit event of ListView.
To resolve this problem, install the latest service pack for Visual Studio 6.0.
If installing the service pack is not an option or you are running a version of Visual Basic earlier than version 6.0, set the LabelEdit property of the ListView control to lvwAutomatic and do not set Cancel equal to True in the in the BeforeLabelEdit event of ListView.
Microsoft has confirmed that this is a bug in the Microsoft products that are listed at the beginning of this article. This bug was corrected in the latest service pack for Visual Studio 6.0.
For additional information about Visual Studio service packs, click the following article numbers to view the articles in the Microsoft Knowledge Base:
194022To download the latest Visual Studio service pack, visit the following Microsoft Web site:
(http://support.microsoft.com/kb/194022/EN-US/ )INFO: Visual Studio 6.0 Service Packs, What, Where, Why
(http://support.microsoft.com/kb/194295/EN-US/ )HOWTO: Tell That a Visual Studio Service Pack Is Installed
Steps to Reproduce Behavior
Article ID: 257495 - Last Review: February 28, 2014 - Revision: 2.2
Contact us for more help