private void buttonFileClick(string filter, TextBox textBox, string nodeName) { string path = currentRunDir; if ("" != textBox.Text) { string folder = System.IO.Path.GetDirectoryName(textBox.Text); if (Directory.Exists(folder)) { path = folder; } } OpenFile file = new OpenFile(path, filter); file.Show(textBox); Save2Config(textBox, nodeName); }