Q: Looping images from folder into picture boxs In this app I am working on the user selects a subfile name from a combobox and within that subfolder are (always) 5 pictures. The names of those images are what ever the camera outputs them as. The purpose of this app is to let the user preview the 5 images in small thumbnail pictureboxes then select one at a time and rename from radiobuttons options, after pushing a "rename" button the code is to save the selected image as the name selected.
What I am having trouble with is I am trying to load these 5 images into 5 pictureboxs named picPreview1,2,3,4 and 5 and then when selecting (clicking) the picture box to have a bigger picturebox show the image clicked larger (this is the picture that will be renamed).
Currently I have this code I got online, but it errors out saying Index was outside the bounds of the array. All the other code I found online is for C# or doesn't work at all or similar to this. I'm not sure how to fix this error. Any help would be appreciated.
Code:
    Public Sub Picture_Preview()
    Dim FileName As String = cmbPartNumber.Text
    Dim pics() As PictureBox = {picPreview1, picPreview2, picPreview3, picPreview4, picPreview5}
    Dim List() As String = Directory.GetFiles("\\HOMESHARE01\Public\Reference Cards\Completed Reference Cards by Part Number" & "\" & FileName, "*.jpg")

    For i As Integer = 0 To pics.Count - 1

        pics(i).Image = Image.FromFile(List(i + 5))

    Next

End Sub

Full code:
Imports System.IO
Public Class Form1
Dim Pictype As String
Private HighlightedPictureBox As PictureBox = Nothing
Private Sub cmbPartNumber_TextChanged(sender As Object, e As EventArgs) Handles cmbPartNumber.TextChanged
    Dim FileName As String = cmbPartNumber.Text
    lblRenameAs.Text = Pictype & FileName
    Label1.Visible = True
    picPreview1.Visible = True
    picPreview2.Visible = True
    picPreview3.Visible = True
    picPreview4.Visible = True
    picPreview5.Visible = True
    Picture_Preview()
End Sub
Private Sub Form1_Load(sender As Object, e As EventArgs) Handles Me.Load
    Dim Folder = From dir In IO.Directory.GetDirectories("\\HOMESHARE01\Public\Reference Cards\Completed Reference Cards by Part Number")
                 Select IO.Path.GetFileName(dir)

    cmbPartNumber.Items.AddRange(Folder.ToArray)
End Sub

Private Sub btnSavePic_Click(sender As Object, e As EventArgs) Handles btnSavePic.Click
    'Check if no radio button checked
    If Not (radSpindle.Checked = True Or radRotorTop.Checked = True Or radRotorBottom.Checked = True Or radDunnageFinal.Checked = True Or radDunnageLayer.Checked = True) Then
        MsgBox("Please Select Picture Type Before Renaming")
        Exit Sub
    End If
    'Check which radio button is checked
    If radSpindle.Checked = True Then
        Pictype = "PicSpindle"
    End If
    If radRotorTop.Checked = True Then
        Pictype = "PicRotorTop"
    End If
    If radRotorBottom.Checked = True Then
        Pictype = "PicRotorBottom"
    End If
    If radDunnageFinal.Checked = True Then
        Pictype = "PicDunnageFinal"
    End If
    If radDunnageLayer.Checked = True Then
        Pictype = "PicDunnageLayer"
    End If



End Sub

Public Sub Picture_Preview()
    Dim FileName As String = cmbPartNumber.Text
    Dim pics() As PictureBox = {picPreview1, picPreview2, picPreview3, picPreview4, picPreview5}
    Dim List() As String = Directory.GetFiles("\\HOMESHARE01\Public\Reference Cards\Completed Reference Cards by Part Number" & "\" & FileName, "*.jpg")

    For i As Integer = 0 To pics.Count - 1

        pics(i).Image = Image.FromFile(List(i + 5))

    Next

End Sub

Private Sub picPreview1_Click(sender As Object, e As EventArgs) Handles picPreview1.Click
    'Get the rectangle of the control and inflate it to represent the border area   
    Dim BorderBounds As Rectangle = DirectCast(sender, PictureBox).ClientRectangle
    BorderBounds.Inflate(-1, -1)

    'Use ControlPaint to draw the border.   
    'Change the Color.Red parameter to your own colour below.   
    ControlPaint.DrawBorder(DirectCast(sender, PictureBox).CreateGraphics,
                                BorderBounds,
                                Color.Red,
                                ButtonBorderStyle.Solid)

    If Not (HighlightedPictureBox Is Nothing) Then
        'Remove the border of the last PictureBox   
        HighlightedPictureBox.Invalidate()
    End If

    'Rememeber the last highlighted PictureBox   
    HighlightedPictureBox = CType(sender, PictureBox)

End Sub

Private Sub picPreview2_Click(sender As Object, e As EventArgs) Handles picPreview2.Click
    'Get the rectangle of the control and inflate it to represent the border area   
    Dim BorderBounds As Rectangle = DirectCast(sender, PictureBox).ClientRectangle
    BorderBounds.Inflate(-1, -1)

    'Use ControlPaint to draw the border.   
    'Change the Color.Red parameter to your own colour below.   
    ControlPaint.DrawBorder(DirectCast(sender, PictureBox).CreateGraphics,
                                BorderBounds,
                                Color.Red,
                                ButtonBorderStyle.Solid)

    If Not (HighlightedPictureBox Is Nothing) Then
        'Remove the border of the last PictureBox   
        HighlightedPictureBox.Invalidate()
    End If

    'Rememeber the last highlighted PictureBox   
    HighlightedPictureBox = CType(sender, PictureBox)
End Sub

Private Sub picPreview3_Click(sender As Object, e As EventArgs) Handles picPreview3.Click
    'Get the rectangle of the control and inflate it to represent the border area   
    Dim BorderBounds As Rectangle = DirectCast(sender, PictureBox).ClientRectangle
    BorderBounds.Inflate(-1, -1)

    'Use ControlPaint to draw the border.   
    'Change the Color.Red parameter to your own colour below.   
    ControlPaint.DrawBorder(DirectCast(sender, PictureBox).CreateGraphics,
                                BorderBounds,
                                Color.Red,
                                ButtonBorderStyle.Solid)

    If Not (HighlightedPictureBox Is Nothing) Then
        'Remove the border of the last PictureBox   
        HighlightedPictureBox.Invalidate()
    End If

    'Rememeber the last highlighted PictureBox   
    HighlightedPictureBox = CType(sender, PictureBox)
End Sub

Private Sub picPreview4_Click(sender As Object, e As EventArgs) Handles picPreview4.Click
    'Get the rectangle of the control and inflate it to represent the border area   
    Dim BorderBounds As Rectangle = DirectCast(sender, PictureBox).ClientRectangle
    BorderBounds.Inflate(-1, -1)

    'Use ControlPaint to draw the border.   
    'Change the Color.Red parameter to your own colour below.   
    ControlPaint.DrawBorder(DirectCast(sender, PictureBox).CreateGraphics,
                                BorderBounds,
                                Color.Red,
                                ButtonBorderStyle.Solid)

    If Not (HighlightedPictureBox Is Nothing) Then
        'Remove the border of the last PictureBox   
        HighlightedPictureBox.Invalidate()
    End If

    'Rememeber the last highlighted PictureBox   
    HighlightedPictureBox = CType(sender, PictureBox)
End Sub

Private Sub picPreview5_Click(sender As Object, e As EventArgs) Handles picPreview5.Click
    'Get the rectangle of the control and inflate it to represent the border area   
    Dim BorderBounds As Rectangle = DirectCast(sender, PictureBox).ClientRectangle
    BorderBounds.Inflate(-1, -1)

    'Use ControlPaint to draw the border.   
    'Change the Color.Red parameter to your own colour below.   
    ControlPaint.DrawBorder(DirectCast(sender, PictureBox).CreateGraphics,
                                BorderBounds,
                                Color.Red,
                                ButtonBorderStyle.Solid)

    If Not (HighlightedPictureBox Is Nothing) Then
        'Remove the border of the last PictureBox   
        HighlightedPictureBox.Invalidate()
    End If

    'Rememeber the last highlighted PictureBox   
    HighlightedPictureBox = CType(sender, PictureBox)
End Sub

Private Sub radSpindle_Click(sender As Object, e As EventArgs) Handles radSpindle.Click
    Dim FileName As String = cmbPartNumber.Text
    Pictype = "PicSpindle"
    lblRenameAs.Text = Pictype & FileName
End Sub

Private Sub radRotorTop_Click(sender As Object, e As EventArgs) Handles radRotorTop.Click
    Dim FileName As String = cmbPartNumber.Text
    Pictype = "PicRotorTop"
    lblRenameAs.Text = Pictype & FileName
End Sub

Private Sub radRotorBottom_Click(sender As Object, e As EventArgs) Handles radRotorBottom.Click
    Dim FileName As String = cmbPartNumber.Text
    Pictype = "PicRotorBottom"
    lblRenameAs.Text = Pictype & FileName
End Sub

Private Sub radDunnageLayer_Click(sender As Object, e As EventArgs) Handles radDunnageLayer.Click
    Dim FileName As String = cmbPartNumber.Text
    Pictype = "PicDunnageLayer"
    lblRenameAs.Text = Pictype & FileName
End Sub

Private Sub radDunnageFinal_Click(sender As Object, e As EventArgs) Handles radDunnageFinal.Click
    Dim FileName As String = cmbPartNumber.Text
    Pictype = "PicDunnageFinal"
    lblRenameAs.Text = Pictype & FileName
End Sub
End Class


A: Solved it....
Old code:
For i As Integer = 0 To pics.Count - 1

    pics(i).Image = Image.FromFile(List(i + 5))

Next

Fixed:
For i As Integer = 0 To pics.Count - 1

    pics(i).Image = Image.FromFile(List(i))

Next

