FIX: Application Error When Binding Dynamically-Created Control
ID: Q175443
|
The information in this article applies to:
-
Microsoft Visual Basic Standard, Professional, and Enterprise Editions, 32-bit only, for Windows, version 4.0
SYMPTOMS
An application error occurs when a Visual Basic program dynamically creates
a text box bound to a remote data control or a data control.
STATUS
Microsoft has confirmed this to be a bug in the Microsoft products listed
at the beginning of this article. This bug has been corrected in Visual
Basic, version 5.0.
MORE INFORMATION
This section shows you how to reproduce the bug in Visual Basic 4.0 using a
data control. You can substitute a remote data control for a data control
and still reproduce the behavior.
Steps to Reproduce Behavior
- Start 32-bit Visual Basic 4.0 or, if it is already running, click New
Project on the File menu.
- Add the following controls to Form1 and set the following properties to
the appropriate controls:
Control Default Name Property Setting
---------------------------------------------------------------
Command Button Command1
Data Data1 DatabaseName Biblio.mdb
RecordSource Authors
Text Box Text1 DataSource Data1
Index 0
- Copy the following code to the Code window of Form1:
Option Explicit
Private Sub Form_Load()
Command1.Caption = "For Remote Data Control"
End Sub
Private Sub Command1_Click()
Dim count As Integer
Dim i As Integer
Static lastcount As Integer
Data1.Refresh
count = 4
If lastcount > 0 Then
For i = lastcount - 1 To 1 Step -1
Unload text1(i)
Next i
End If
If count > 0 Then
For i = 1 To count - 1
Load text1(i)
text1(i).Left = text1(0).Left + (i * 1335)
text1(i).Visible = True
Next i
End If
lastcount = count
End Sub
- On the Run menu, click Start or press the F5 key to start the program.
Each time you click the command button, three text boxes appear. On the
third click, an application error occurs displaying one of the following
messages and Visual Basic ends:
Windows NT 3.51:
An application error has occurred and an application error log is
being generated.VB32.exe.
Exception: access violation (0xc0000005), Address: 0x00402a38
Windows 95:
VB32 caused an invalid page fault in module VB32.EXE at
0137:00402a3a.
-and-
VB32 caused an invalid page fault in module KERNEL32.DLL at
0137:bff9a07c.
Windows 98:
VB32 caused an invalid page fault in module VB32.EXE at
015f:00402a3a.
-or-
VB32 caused an invalid page fault in module KERNEL32.DLL at
015f:bff9d706.
Additional query words:
ipf gpf crash kbVBp400bug kbVBp500fix kbVBp kbDSupport kbdsd
kbTextBox
Keywords : kbGrpVB
Version : WINDOWS:4.0
Platform : WINDOWS
Issue type : kbbug