Try this to set the file type in the dialog:
OpenFileDialog dialog = new OpenFileDialog();
dialog.Filter = "wav files (*.wav)|*.wav";
dialog.InitialDirectory = @"C:\"; // You may not need this.
if (dialog.ShowDialog() == DialogResult.OK) // Or this; I was just being thorough.
{
// Your code can go here.
}
Just make sure that when using the .Filter
property, you follow the pattern I have above, or else it won't work. Also, as was mentioned above, you may want to do some validation after the user selects something.