CSharp examples for System.Windows.Forms:Dialog
Try Files Paths with OpenFileDialog
using System.Windows.Forms; using System.Windows; using System.Linq; using System.Collections.Generic; public class Main{ public static bool TryFilesPaths(string dialogTitle, string filter, out List<string> filesPaths) {/*from w w w . ja v a 2 s .c o m*/ var fileSelector = new OpenFileDialog() { Title = dialogTitle, Filter = filter, Multiselect = true, CheckFileExists = true, DefaultExt = filter.Split('|').ElementAt(1).Replace("*", "") // It SHOULD be an extension method, so todo }; if (fileSelector.ShowDialog() == DialogResult.OK) { filesPaths = fileSelector.FileNames.ToList(); return true; } else { filesPaths = new List<string>(); return false; } } }