Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Media;
- using System.Windows.Forms;
- namespace R810ReproducirWAV
- {
- public partial class Principal : Form
- {
- public Principal()
- {
- InitializeComponent();
- }
- private void btnReproducirWav_Click(object sender, EventArgs e)
- {
- OpenFileDialog ofd = new OpenFileDialog();
- ofd.InitialDirectory = @"C:\Windows\Media";
- ofd.Filter = "Archivos WAV|*.wav|All File|*.*";
- if (DialogResult.OK == ofd.ShowDialog())
- {
- SoundPlayer reproductor = new SoundPlayer(ofd.FileName);
- try
- {
- reproductor.Play();
- }
- catch (Exception)
- {
- MessageBox.Show("Error al reproducir el archivo seleccionado.");
- }
- finally
- {
- reproductor.Dispose();
- }
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement