Microsoft KB Archive/161359

= PRB: Class Names in VFP 5.0 are Case Sensitive =

Article ID: 161359

Article Last Modified on 12/3/2003

-

APPLIES TO


 * Microsoft Visual FoxPro 3.0b Standard Edition
 * Microsoft Visual FoxPro 5.0 Standard Edition
 * Microsoft Visual FoxPro 6.0 Professional Edition
 * Microsoft Visual FoxPro 3.0 for Macintosh

-



This article was previously published under Q161359



SYMPTOMS
When referencing an object class or base class for comparison, the class name is case sensitive.

When testing the class property of a command button and comparing the property setting to the string "commandbutton" rather than "Commandbutton," the code fails. The 'c' in Commandbutton must be capitalized.



RESOLUTION
The text used for comparison must match the property setting exactly.



STATUS
This behavior is by design.



Steps to Reproduce Behavior
 Create a form with a command button. The base class is Commandbutton and the class is Commandbutton.  Place the following code in the Click event of a command button: i=1 FOR i = 1 to ThisForm.ControlCount IF ThisForm.Controls(i).Class = "commandbutton" THEN WAIT WINDOW ThisForm.Controls(i).Name ELSE WAIT WINDOW "This is not a Command Button: "  + ; ThisForm.Controls(i).Name ENDIF NEXT i                       

The code above returns a Wait window indicating the commandbutton class is not a command button because the 'c' in commandbutton is lowercase. Replace the lowercase "c" with an uppercase "C," and it works properly.

Replace: IF ThisForm.Controls(i).Class = "commandbutton" THEN With: IF ThisForm.Controls(i).Class = "Commandbutton" THEN

Additional query words: VFoxWin kbdse VFoxMac

Keywords: KB161359

-

[mailto:TECHNET@MICROSOFT.COM Send feedback to Microsoft]

© Microsoft Corporation. All rights reserved.