Search Files with OpenFileDialog - CSharp System.Windows.Forms

CSharp examples for System.Windows.Forms:Dialog

Description

Search Files with OpenFileDialog

Demo Code


using System.Windows.Forms;
using System.Text;
using System.Linq;
using System.Collections.Generic;
using System;/*from  ww  w.j a va2s .c  o  m*/

public class Main{
        public static List<string> SearchFiles()
        {
            List<string> filPath = new List<string>();
            OpenFileDialog dialog = new OpenFileDialog();
            dialog.Multiselect = true;
            dialog.DereferenceLinks = true;

            dialog.Filter = "All File(*.*)|*.*";
            dialog.FilterIndex = 0;
            dialog.RestoreDirectory = false;
            if (dialog.ShowDialog() == DialogResult.OK)
            {
                filPath.AddRange(dialog.FileNames);
            }
            return filPath;
        }
}

Related Tutorials