FIX: Checking TYPE() of Combo Box Or Listbox Value When RowSource Missing May Crash Visual FoxPro (297839)



The information in this article applies to:

  • Microsoft Visual FoxPro for Windows 3.0
  • Microsoft Visual FoxPro for Windows 3.0b
  • Microsoft Visual FoxPro for Windows 5.0
  • Microsoft Visual FoxPro for Windows 5.0a
  • Microsoft Visual FoxPro for Windows 6.0

This article was previously published under Q297839

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
				

Modification Type:MajorLast Reviewed:5/12/2003
Keywords:kbBug kbfix KB297839