HOWTO: VB3: Pass an Array of Controls to a SUB or FUNCTIONLast reviewed: March 24, 1997Article ID: Q143426 |
The information in this article applies to:
- Microsoft Visual Basic programming system for Windows, version 3.0
SUMMARYIn Microsoft Visual Basic version 3.0 for Windows, it is not possible to pass a control array to a user defined SUB or FUNCTION. You can only pass elements of a control array.
WORKAROUNDIn order to work around this limitation, you can create an array of specific objects and pass this array to a Sub or Function. Step-by-Step example The following example converts the content of all the Textboxes on a form to upper-case characters when the user clicks on the Command Button.
AddControlArrayElement Text1The code in the procedure would be as follows:
Sub AddControlArrayElement (ControlArray as Object) NextElement% = ControlArray.Count Load ControlArray(NextElement%) ControlArray(NextElement%).Top = ControlArray(NextElement%-1).Top+100 ControlArray(NextElement%).Visible=True End Sub |
Keywords : vbwin kbprg
© 1998 Microsoft Corporation. All rights reserved. Terms of Use. |