Share via


SoundPlayer

Windows Forms 2.0 provides a component to play sound. This component, called SoundPlayer, provides the ability to play sounds that come from files, streams and preset system sounds. Sounds can also be played asynchronously.

The SoundPlayer component can be found in the toolbox and can be added to any form. As with most components, there isn’t any UI to the SoundPlayer. The most common way to use the SoundPlayer component is in code by setting the Stream property and calling the Play() method. You can also set the SoundLocation or Stream properties in the designer and use the SoundPlayer’s smart tag to preview the sound stream. Support for playing system sounds is available in the SystemSounds class.

Note that .WAV is the only supported sound file format.