0

I am making a media player, and currently it only finds mp3 files. I now want to increase which file types it can find, such as wavs, aacs, etc. How can I accomplish this?

Here is my current code:

private void button2_Click(object sender, EventArgs e)
    {
        string musicPath = Environment.GetFolderPath(Environment.SpecialFolder.MyMusic);
        folderBrowserDialog1.SelectedPath = musicPath;
        if (folderBrowserDialog1.ShowDialog() == DialogResult.OK)
        {
            System.IO.DirectoryInfo dinfo = new System.IO.DirectoryInfo(folderBrowserDialog1.SelectedPath);
            System.IO.FileInfo[] Files = dinfo.GetFiles("*.mp3"); //This is the line I am checking for files with a certain extension.
            MusicBox.Items.Clear();
            foreach (System.IO.FileInfo file in Files)
            {
                MusicBox.Items.Add(file.FullName);
            }

        }
    }
}
Klink45
  • 439
  • 1
  • 6
  • 21
  • Already answered [here](http://stackoverflow.com/questions/163162/can-you-call-directory-getfiles-with-multiple-filters?noredirect=1&lq=1) and [here](http://stackoverflow.com/questions/3527203/getfiles-with-multiple-extentions). – gowrath Aug 30 '16 at 23:34
  • Thank you. I have marked it as a duplicate :) – Klink45 Aug 30 '16 at 23:39

0 Answers0