DOCUMENT:Q175443 22-OCT-1997 [vbwin] TITLE :FIX: Application Error When Binding Dynamically-Created Control PRODUCT :Microsoft Visual Basic for Windows PROD/VER:WINDOWS:4.0 OPER/SYS:WINDOWS KEYWORDS:vb432 VB4WIN ====================================================================== --------------------------------------------------------------------- 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 --------------------------- 1. Start 32-bit Visual Basic 4.0 or, if it is already running, click New Project on the File menu. 2. 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 3. 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 4. 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. Additional query words: ipf gpf crash \ ====================================================================== Keywords : vb432 VB4WIN Version : WINDOWS:4.0 Platform : WINDOWS Issue type : kbbug Solution Type : kbfix ============================================================================= THE INFORMATION PROVIDED IN THE MICROSOFT KNOWLEDGE BASE IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND. MICROSOFT DISCLAIMS ALL WARRANTIES, EITHER EXPRESS OR IMPLIED, INCLUDING THE WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL MICROSOFT CORPORATION OR ITS SUPPLIERS BE LIABLE FOR ANY DAMAGES WHATSOEVER INCLUDING DIRECT, INDIRECT, INCIDENTAL, CONSEQUENTIAL, LOSS OF BUSINESS PROFITS OR SPECIAL DAMAGES, EVEN IF MICROSOFT CORPORATION OR ITS SUPPLIERS HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. SOME STATES DO NOT ALLOW THE EXCLUSION OR LIMITATION OF LIABILITY FOR CONSEQUENTIAL OR INCIDENTAL DAMAGES SO THE FOREGOING LIMITATION MAY NOT APPLY. Copyright Microsoft Corporation 1997.