OK, I am using VS 2010 C#, and I am trying to use a file path (e.g. C:/Desktop/blahblah) as a string for the GetFiles method, so that once a folder is chosen from a dialog, the path to that folder will be passed to GetFiles, and the logic will happen. Here is the relevant snippet.
// Bring up a dialog to open a file.
private void button2_Click(object sender, EventArgs e)
bool fileOpened = false;
FolderBrowserDialog filePath = new FolderBrowserDialog();
// If a file is not opened, then set the initial directory to the
// FolderBrowserDialog.SelectedPath value.
folderBrowserDialog1.SelectedPath = @"C:\Users\Giles Kingsley\Desktop\ProjectImages";
// Display the openFile dialog.
DialogResult result = folderBrowserDialog1.ShowDialog();
// OK button was pressed.
if (result == DialogResult.OK)
string openFileName = filePath.SelectedPath;
public void StartUpdate()
foreach (string img in Directory.GetFiles(openFileName))
Directly above here is the foreach statement with the Getfiles call. Is this just a syntax problem?