Hi I Have 100 Picture Box(PictureBox1-100) And I want to use Each PictureBox with loop like

Dim left as Integer
Do while left > 1
PictureBox 'Picture Box number i used left = 'My Procedure
Left += 1
Loop

How Can I use Each PictureBox From 1 to 100
Thank For Help

Hi I Have 100 Picture Box(PictureBox1-100) And I want to use Each PictureBox with loop like

Dim left as Integer
Do while left > 1
PictureBox 'Picture Box number i used left = 'My Procedure
Left += 1
Loop

How Can I use Each PictureBox From 1 to 100
Thank For Help

Create List(Of T).

Dim pboxes As New List(Of PictureBox)

        pboxes.Add(PictureBox1)
        pboxes.Add(PictureBox2)
        pboxes.Add(PictureBox3)

        For Each t As PictureBox In pboxes
            .....
        Next

        'You can access list element through indices

        For i As Integer = 0 To pboxes.Count - 1
            ...
        Next
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.