Article ID: 257524
Article Last Modified on 8/7/2007
APPLIES TO
- Microsoft Visual Basic 6.0 Learning Edition, when used with:
- Microsoft Windows 95
- Microsoft Windows 98 Standard Edition
- Microsoft Windows Millennium Edition
- Microsoft Visual Basic 6.0 Professional Edition, when used with:
- Microsoft Windows 95
- Microsoft Windows 98 Standard Edition
- Microsoft Windows Millennium Edition
- Microsoft Visual Basic 6.0 Enterprise Edition, when used with:
- Microsoft Windows 95
- Microsoft Windows 98 Standard Edition
- Microsoft Windows Millennium Edition
This article was previously published under Q257524
SYMPTOMS
An Invalid Page Fault is encountered when dynamically loading and populating ListView controls within a control array.
RESOLUTION
This problem can be solved in one of three ways:
- Install Visual Studio Service Pack 4.
- Dynamically load all ListView controls before adding ListItems collections to any of them.
- Pre-load the ListView controls at design time instead of creating them dynamically.
STATUS
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:
194022 INFO: Visual Studio 6.0 Service Packs, What, Where, Why
194295 HOWTO: Tell That a Visual Studio Service Pack Is Installed
To download the latest Visual Studio service pack, visit the following Microsoft Web site:
MORE INFORMATION
This behavior occurs under the Microsoft Windows 95, Microsoft Windows 98 and Microsoft Windows Me operating systems but does not occur under Microsoft Windows NT or Microsoft Windows 2000.
By using a DoEvents command during the process of dynamically loading the controls, you may prevent the error from occurring immediately. However, the error still occurs when you terminate the application.
In addition, this problem does not occur if all ListView controls are loaded before items are added to them or if the ListView controls are all loaded at design time.
Steps to Reproduce Behavior
- Create a new Standard EXE project. Form1 is created by default.
- On the Project menu, select Components, check Microsoft Windows Common Controls 6.0, and then click OK.
- Add a ListView control to Form1.
- Set the Index property of the ListView control to 0.
Paste the following code into Form1's code window:
Option Explicit Private Sub Form_Load() Dim i As Integer Dim j As Integer Dim objListItem As ListItem ' Set view to report ListView1(0).View = lvwReport ' Add some columns to listview ListView1(0).ColumnHeaders.Add , "col1", "col1" ListView1(0).ColumnHeaders.Add , "col2", "col2" ListView1(0).ColumnHeaders.Add , "col3", "col3" ' Load and populate total of 6 ListView controls For i = 0 To 5 If i > 0 Then ' Create a new ListView control Load ListView1(i) ' Position and show the new control ListView1(i).Left = ListView1(i - 1).Left + 250 ListView1(i).Top = ListView1(i - 1).Top + 250 ListView1(i).Visible = True End If ' Add 10 data items to the listview just created For j = 1 To 10 Set objListItem = ListView1(i).ListItems.Add(, , "data1-" & j) objListItem.SubItems(1) = "data2-" & j objListItem.SubItems(2) = "data3-" & j ' Set the tag property of the new ListItem objListItem.Tag = j Next j Next i End Sub
- Run the program. RESULT: An Invalid Page Fault occurs.
Additional query words: sp4 IPF GPF
Keywords: kbbug kbcmnctrls kbctrl kbfix kblistview kbvs600sp4fix kbvs600sp5fix KB257524