Create Control Array in Visual Baisc 2005 & 2008

Public Class Form1 Dim MyPictureBoxes() As PictureBox Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load ReDim MyPictureBoxes(29) Dim i As Integer For i = 0 To UBound(MyPictureBoxes) MyPictureBoxes(i) = New PictureBox Me.Controls.Add(MyPictureBoxes(i)) With MyPictureBoxes(i) .Visible = False .BorderStyle = BorderStyle.Fixed3D .Name = “MyPicterbox ” & i.ToString ‘U’ll have to set the … Read more

Share