This is how I did it.
openFileDialog1.InitialDirectory = Path.Combine(Path.GetDirectoryName(Application.StartupPath), "FolderName");
if (openFileDialog1.ShowDialog() == DialogResult.OK)
{
while(Path.GetDirectoryName(openFileDialog1.FileName) != Path.Combine(Path.GetDirectoryName(Application.StartupPath), "FolderName")){
MessageBox.Show("Please select .EXE which is in the default folder", "Wrong folder", MessageBoxButtons.OK, MessageBoxIcon.Information);
openFileDialog1.ShowDialog();
}
}
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…