SoundPlayer.SoundLocation Property

Definition

Gets or sets the file path or URL of the .wav file to load.

C#
public string SoundLocation { get; set; }

Property Value

The file path or URL from which to load a .wav file, or Empty if no file path is present. The default is Empty.

Examples

The following code example demonstrates the use of the SoundLocation property to assign the .wav file source to an instance of the SoundPlayer class. This code example is part of a larger example provided for the SoundPlayer class.

C#
try
{
    // Assign the selected file's path to 
    // the SoundPlayer object.  
    player.SoundLocation = filepathTextbox.Text;

    // Load the .wav file.
    player.Load();
}
catch (Exception ex)
{
    ReportStatus(ex.Message);
}

Remarks

This property is set to String.Empty when the Stream property is set to a Stream.

Applies to

Product Versions
.NET 8 (package-provided), 9 (package-provided)
.NET Framework 2.0, 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1
Windows Desktop 3.0, 3.1, 5, 6, 7, 8, 9

See also