KnowledgeBase Archive

An Archive of Early Microsoft KnowledgeBase Articles

View on GitHub

Q297839: FIX: TYPE() of Combo/List Box Value May Crash VFP

Article: Q297839
Product(s): Microsoft FoxPro
Version(s): 3.0,3.0b,5.0,5.0a,6.0
Operating System(s): 
Keyword(s): kbvfp kbvfp300 kbvfp300b kbvfp500aBUG kbvfp500bug kbvfp600bug kbGrpDSFox kbDSupport
Last Modified: 15-SEP-2001

-------------------------------------------------------------------------------
The information in this article applies to:

- Microsoft Visual FoxPro for Windows, versions 3.0, 3.0b, 5.0, 5.0a, 6.0 
-------------------------------------------------------------------------------

SYMPTOMS
========

In Visual FoxPro version 5.0 and later, if the RowSource of a list box or combo
box is a non-existent table and you check the TYPE() of the Value property
during the form's Init method, you may receive the following error message:

  Fatal error: Exception code=C0000005

In Visual FoxPro version 5.0a, you may receive the following error message:

  Internal Consistency error.

STATUS
======

This problem was corrected in Microsoft Visual FoxPro version 7.0 for Windows.

MORE INFORMATION
================

This behavior does not occur in Visual FoxPro version 3.0. An error occurs, and
the form does not appear.

Steps to Reproduce Behavior
---------------------------

The following code creates and runs a form that demonstrates the problem.

  SET SAFETY OFF
  CLEAR ALL
  CLOSE DATABASES ALL

  CREATE FORM testType NOWAIT
  ASELOBJ(laObj, 1) && Gives you the form containing the selected object.

  loForm = laObj[1]
  loForm.AutoCenter = .T.

  loForm.AddObject('lstValues','listbox')
  WITH loForm.lstValues
     .RowSourceType = 6
     .RowSource = "testTable.f1"
     .Name = "lstValues"
  ENDWITH

  loForm.WriteMethod('Init', [WAIT WINDOW TYPE("ThisForm.lstValues.Value")])

  KEYBOARD 'Y' CLEAR  && Answers "Yes" to Save dialog.
  RELEASE WINDOW 'Form Designer'

  DO FORM testType

Additional query words:

======================================================================
Keywords          : kbvfp kbvfp300 kbvfp300b kbvfp500aBUG kbvfp500bug kbvfp600bug kbGrpDSFox kbDSupport 
Technology        : kbVFPsearch kbAudDeveloper kbVFP300 kbVFP300b kbVFP500 kbVFP600 kbVFP500a
Version           : :3.0,3.0b,5.0,5.0a,6.0
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 1986-2002.