Knowledge Base

FIX: Error if Listview Cleared Using the AfterLabeledit Event

Article ID: 141681

Article Last Modified on 11/18/2003


APPLIES TO


This article was previously published under Q141681

SYMPTOMS

When you edit a ListItem object in a ListView control in the 32-bit edition of Visual Basic for Windows, the following Windows Common Controls message appears and your Visual Basic program ends due to an application error:
This item's control has been deleted.

STATUS

Microsoft has confirmed this to be a bug in the Microsoft products listed at the beginning of this article. This problem has been fixed in Microsoft Windows 98.

MORE INFORMATION

Steps to Reproduce Problem

  1. Start the 32-bit version of Visual Basic 4.0 or if it is already running, on the File menu, click New Project.
  2. Add a ListView control to the Form1 form.
  3. Add the following code to the Form1 code window:
          Private Sub Form_Load()
             Call ListView1.ListItems.Add(, , "Edit this Line")
          End Sub
    
          Private Sub ListView1_AfterLabelEdit(Cancel As Integer, _
                                                NewString As String)
             ListView1.ListItems.Clear
          End Sub
    
          Private Sub ListView1_Click()
             'Without this line in this event, you have to triple-click
             'in order to edit the listitem
             ListView1.StartLabelEdit
          End sub
  4. Press the F5 key to start the program. Click the ListItem in the ListView control.
  5. Delete the ListItem text by pressing the DEL key, and then press the ENTER key. The Windows Common Controls dialog box with the message, "This item's control has been deleted." displays. Click the OK button. An application error occurs with one of the following messages and Visual Basic stops with an application error:
          Windows NT 3.51-An application error has occurred and an application
                          error log is being generated. VB32.exe. Exception:
                          Access violation (0xc0000005), Address: 0x77d86066)
          Windows 95-VB32 caused an invalid page fault in module COMCTL32.DLL
                     at 0137:bff0110b.

Additional query words: kbCtrl

Keywords: kbbug kbfix kboswin98fix KB141681