Microsoft KB Archive/156343

= PRB: Unknown Member Error Using Thisformset.ActiveControl =

Article ID: 156343

Article Last Modified on 10/15/2003

-

APPLIES TO


 * Microsoft Visual FoxPro 5.0 Standard Edition
 * Microsoft Visual FoxPro 6.0 Professional Edition

-



This article was previously published under Q156343



SYMPTOMS
Referencing an active control with Thisformset.ActiveControl. generates the following error message in Visual FoxPro version 5.0:

Unknown member ACTIVECONTROL

Referencing an active control in this manner does not generate an error in Visual FoxPro 3.0 and 3.0b.



RESOLUTION
Reference the active control as follows: Thisformset.ActiveForm.ActiveControl. This works properly in all versions of Visual FoxPro.



STATUS
This behavior is by design.



MORE INFORMATION
This is undocumented in Visual FoxPro 3.0 and is not intended to work, as Formset objects do not have an ActiveControl property in any version of Visual FoxPro.

Steps to Reproduce Behavior
  Run the following code from a program (.prg) file: * Start of code example *  PUBLIC oFormset oFormset = CREATEOBJECT('formset') oFormset.ADDOBJECT('form1','frm') oFormset.form1.VISIBLE=.T.  oFormset.SHOW

DEFINE CLASS frm AS FORM CAPTION = "Click on Form to Demonstrate Error" ADD OBJECT text1 AS TEXTBOX WITH ; TOP = 100, ; LEFT = 120

PROCEDURE CLICK * This will not generate an error in VFP 3.0 or 3.0b WAIT WINDOW THISFORMSET.ACTIVECONTROL.NAME TIMEOUT 3 ENDPROC

ENDDEFINE *  * End of code example  Click anywhere on the form (outside of the text box). In Visual FoxPro 5.0 or 6.0, the error "Unknown member ACTIVECONTROL" appears. In Visual FoxPro 3.0 or 3.0b, "TEXT1" is displayed in the WAIT WINDOW.

The preceding code works without error in any version of Visual FoxPro if modified as follows: PROCEDURE CLICK * This will not generate an error in VFP 3.0, 3.0b, or 5.0 WAIT WINDOW THISFORMSET.ACTIVEFORM.ACTIVECONTROL.NAME TIMEOUT 3 ENDPROC

Keywords: KB156343

-

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

© Microsoft Corporation. All rights reserved.