Question: College student in an advanced VB class who is turning to a forum for help - I've found a few examples of code but am having a hard time figuring this one out.. any and all help is appreciated :)

This application imports a .txt file stored in the bin, debug folder called data.txt
..20 records, 3 lines per record, the last line is the student's grade, I need to average the grades by summing each records grade and dividing by 20 and then displaying on the lstbox showing the average.

So far I've got.. 

```
    Dim objReader As IO.StreamReader
    Dim intFill As Integer
    Dim intCount As Integer = 0
    Dim intAverage As Integer
    Dim strLocationAndNameOfFile As String = "data.text"

    If IO.File.Exists(strLocationAndNameOfFile) = True Then
        objReader = IO.File.OpenText(strLocationAndNameOfFile)
    Else
        MsgBox("The file is not available. Restart the program when the file is avilable", , "Error")
        Me.Close()
    End If

    If IO.File.Exists(strLocationAndNameOfFile) Then
        objReader = IO.File.OpenText(strLocationAndNameOfFile)
        Do While objReader.Peek <> -1
            _strName(intCount) = Convert.ToString(objReader.ReadLine())
            _strItemID(intCount) = Convert.ToString(objReader.ReadLine())
            _intGrade(intCount) = Convert.ToInt32(objReader.ReadLine())
            intCount += 1
        Loop
        objReader.Close()
    End If

    For intFill = 0 To (_strName.Length - 1)
        *'intAverage = SUM OF ALL AVERAGES / LENGTH OF ARRAY -1*
        Me.lstAverage.Items.Add(intAverage.ToString())

```

Answer: 
Use the glob module to help find the relevant files.

As for images failing to appear:

```
import Tkinter as tk
from PIL import Image, ImageTk
import glob

root = tk.Tk()

labels = []

for jpeg in glob.glob("C:/Users/Public/Pictures/Sample Pictures/*.jpg")[:5]:
    im = Image.open(jpeg)
    im.thumbnail((96, 170), Image.ANTIALIAS)
    photo = ImageTk.PhotoImage(im)
    label = tk.Label(root, image=photo)
    label.pack()    
    label.img = photo # *
    # * Each time thru the loop, the name 'photo' has a different
    # photoimage assigned to it.
    # This means that you need to create a separate, 'longer-lived'
    # reference to each photoimage in order to prevent it from
    # being garbage collected.
    # Note that simply passing a photoimage to a Tkinter widget
    # is not enough to keep that photoimage alive.    
    labels.append(label)

root.mainloop()

```
I do not think you are handling it correctly where you say `panels = label.grid()`. Instead, try to just do `label.grid` so it is not an assignment operator but an action.