using System.Media;
private void button1_Click(object sender, EventArgs e) { if (openfiledialog1.ShowDialog() == System.Windows.Forms.DialogResult.OK) { textBox1.Text = openfiledialog1.FileName; } }
private void button2_Click(object sender, EventArgs e) { try { // play the audio file audio.SoundLocation = textBox1.Text; audio.Load(); audio.Play(); } // if not a .wav file, display the error message catch (Exception ex) { MessageBox.Show(ex.Message); } }