I am not completely sure, but from the error messages it sounds like you need to change the code to this.

Code:
foreach (FileInfo fiTemp in file)
{
    listBox1.Items.Add(fiTemp.Name);
}
The error message "Type and identifier are both required in a foreach statement" means that you need to declare what type of object you are looking for in "file". Don't declare the object beforehand, it must be declared in the foreach.