I started redesigning a picture viewer (of my grandchildren) after someone had asked a question about loading images. So I could distribute this app to friends and relatives I decided the best way to do it was to include a folder to be installed on their C: This way I could update the folder of pictures at anytime without changing the application. Right now I select either individual names or all the pictures from a combo box like this:

vb Code:
  1. Private Sub cboSelectPicture_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cboSelectPicture.SelectedIndexChanged
  2.       Me.Refresh()
  3.       Try
  4.           Dim selectedName As String = Me.cboSelectPicture.Text
  5.           ' Get and display pictures of only grandchild selected
  6.           If selectedName <> "All Grandchildren" Then
  7.               Dim imageFiles As String() = IO.Directory.GetFiles("C:\Pictures\", selectedName & "*.jpg")
  8.               Dim images As New ArrayList
  9.               For Each imageFile As String In imageFiles
  10.                     Select Case IO.Path.GetExtension(imageFile).ToLower()
  11.                         Case ".jpg", ".bmp", ".gif", ".png"
  12.                             images.Add(Image.FromFile(imageFile))
  13.                     End Select
  14.               Next imageFile
  15.               Me.images = DirectCast(images.ToArray(GetType(Image)), Image())
  16.           ElseIf selectedName = "All Grandchildren" Then
  17.               ' Get and display pictures of all grandchildren
  18.               Dim imageFiles As String() = IO.Directory.GetFiles("C:\Pictures\", "*.jpg")
  19.               Dim images As New ArrayList
  20.               For Each imageFile As String In imageFiles
  21.                   Select Case IO.Path.GetExtension(imageFile).ToLower()
  22.                       Case ".jpg", ".bmp", ".gif", ".png"
  23.                             images.Add(Image.FromFile(imageFile))
  24.                   End Select
  25.               Next imageFile
  26.               Me.images = DirectCast(images.ToArray(GetType(Image)), Image())
  27.           End If
  28.       Catch ex As Exception
  29.           MessageBox.Show("cboSelectPicture_SelectedIndexChanged: " & ex.ToString)
  30.       End Try
  31. End Sub

Is there a more effective way of doing this or is this as good as it gets?