Playing a wave file just got a whole lot easier.
Play Wave File (.NET 2.0 Framework)
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using System.Media;//Make sure you have this.
namespace WindowsApplication1
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void Form1_Load(object sender, EventArgs e)
{
SoundPlayer player = new SoundPlayer();
string path = "C:\\windows\\media\\ding.wav";
player.SoundLocation = path; //Set the path
player.Play(); //play it
}
}
}
Be a part of the DaniWeb community
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.