Login | Register   
RSS Feed
Download our iPhone app
Browse DevX
Sign up for e-mail newsletters from DevX

By submitting your information, you agree that devx.com may send you DevX offers via email, phone and text message, as well as email offers about other products and services that DevX believes may be of interest to you. DevX will process your information in accordance with the Quinstreet Privacy Policy.

Tip of the Day
Language: Visual Basic
Expertise: Beginner
Apr 24, 2001



Application Security Testing: An Integral Part of DevOps

Use a Variable When Loading Controls in A Control Array

Using a variable when loading a control in a control array simplifies the code and makes it run faster.


1) Create a new standard EXE project.

2) Add a Label to Form1.

3) Set the Index property of Label1 to 0.

4) Add a CommandButton to Form1.

5) Insert the following lines of code into Form1:
Private Sub Command1_Click()
Dim I As Integer
Dim NewLabel As Label
Dim LastLabel As Label
    Set LastLabel = Label1(0)
    For I = 1 To 9
        Set NewLabel = Label1(I)
        Load NewLabel
        NewLabel.Move LastLabel.Left + LastLabel.Height, 
LastLabel.Top + LastLabel.Height
        NewLabel.Visible = True
        Set LastLabel = NewLabel
End Sub
Andreas Hillqvist
Comment and Contribute






(Maximum characters: 1200). You have 1200 characters left.



We have made updates to our Privacy Policy to reflect the implementation of the General Data Protection Regulation.
Thanks for your registration, follow us on our social networks to keep up-to-date