private void browseButton_Click(object sender, EventArgs e) { /*display dialog to choose file*/ OpenFileDialog fDialog = new OpenFileDialog(); dadstorm.Title = "Open Configuration File"; dadstorm.Filter = "Config Files|*.config|All Files|*.*"; dadstorm.InitialDirectory = PuppetMaster.getInputDir(); dadstorm.ShowDialog(); //store selected filename String configFilename = dadstorm.FileName; if (File.Exists(configFilename)) { pathTextBox.Text = configFilename; //clean current preview text box previewTextBox.Text = ""; //empty intruction queue, if any PuppetMaster.clearCommands(); //tell puppet master to start parsing //send action delegate because forms & threads shenanigans Parser.execute(configFilename, new Action <String, LineSyntax>(previewTextBox_Update)); } }