Microsoft KB Archive/137950

= BUG: Valid Event Doesn't Fire in Control Array of Text Boxes =

Article ID: 137950

Article Last Modified on 5/7/2003

-

APPLIES TO


 * Microsoft Visual FoxPro 3.0 Standard Edition
 * Microsoft Visual FoxPro 3.0b Standard Edition
 * Microsoft Visual FoxPro 5.0 Standard Edition
 * Microsoft Visual FoxPro 5.0a
 * Microsoft Visual FoxPro 6.0 Professional Edition

-



This article was previously published under Q137950



SYMPTOMS
Pages 78-79 of the Visual FoxPro 3.0 Developer's Guide, has an example of creating a control array containing command buttons and check boxes. While this example works, creating a control array containing text boxes does not work as expected.

NOTE: This example is located on page 72 of the Visual FoxPro 5.0 Developer's Guide. In Visual FoxPro 6.0, if you have the Online help installed, from the Help menu, choose Search to open the MSDN library Visual Studio 6.0 window. Clear the three check boxes in the lower left portion of the screen, and type Creating Arrays of Members in the Search For text box. Click the first selection, to open "Chapter 3: Object Oriented Programming". Scroll to the bottom of the chapter and look for the heading, "Creating Arrays of Members".



WORKAROUND
The following code demonstrates how to create a form with a control array that has three text boxes: *_ there are 2 bugs here they are pointed out with comments PUBLIC oForm oForm = CREATEOBJECT("Form") oForm.AddObject("myarray","ctrlarr") oForm.myarray.Visible = 1 oForm.Visible = 1

DEFINE CLASS ctrlarr AS Container *- Make this a control array DIMENSION txtdim(3) ADD OBJECT txtdim(1) AS mytext WITH Top = 10 ADD OBJECT txtdim(2) AS mytext WITH Top = 40 ADD OBJECT txtdim(3) AS mytext WITH Top = 70

PROCEDURE txtdim.VALID LPARAMETERS nIndex WAIT WINDOW PROGRAM + ' ' + This.Parent.txtdim(nIndex).value **********************************************************************  * Should be able to use this syntax this(nIndex).value not * this.parent.txtdim(nIndex).value*** **********************************************************************  ENDPROC ENDDEFINE

DEFINE CLASS mytext AS TextBox **********************************************************************  * If the following two lines are changed to comments, the valid in the * control array won't fire *** **********************************************************************

PROCEDURE VALID ENDPROC ENDDEFINE

*** end code



STATUS
Microsoft has confirmed this to be a problem in the Microsoft products listed at the beginning of this article. We are researching this problem and will post new information here in the Microsoft Knowledge Base as it becomes available.



Steps to Reproduce Problem
Follow the example in the Developer's Guide. For example: PUBLIC oForm oForm = CREATEOBJECT("Form") oForm.AddObject("myarray","ctrlarr") oForm.myarray.visible = 1 oForm.Visible = 1

DEFINE CLASS ctrlarr AS Container *- Make this a control array DIMENSION txtdim(3) ADD OBJECT txtdim(1) AS textbox WITH Top = 10 ADD OBJECT txtdim(2) AS textbox WITH Top = 40 ADD OBJECT txtdim(3) AS textbox WITH Top = 70

PROCEDURE txtdim.Valid LPARAMETERS nIndex WAIT WINDOW This(nIndex).Value + ' ' + STR(nindex) ENDDEFINE The code should work. However, when you run it, no errors occur, but the Valid event does not fire.

Additional query words: kbvfp600

Keywords: kbbug kbprogramming kbcode KB137950

-

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

© Microsoft Corporation. All rights reserved.