Quantcast
Channel: VBForums - Visual Basic .NET
Viewing all articles
Browse latest Browse all 27417

VS 2022 Program plays a .wav sound file on my desktop but not on my laptop

$
0
0
I've written a program in Visual Basic that, among other things, plays a .wav sound file. It works as expected on my desktop computer. When I put the executable on my laptop where Visual Studio is not installed and run it, it works fine except that it doesn't play the sound file. Here is a test program I wrote to investigate the problem:
Code:

Sub Idle_Load() Handles Me.Load
    Dim appPath, file As String
    appPath = Application.StartupPath
    file = appPath & "\Beep50.wav"
    My.Computer.Audio.PlaySystemSound(System.Media.SystemSounds.Beep)
    System.Threading.Thread.Sleep(1000)
    My.Computer.Audio.Play(file, AudioPlayMode.WaitToComplete)
End Sub

The laptop plays the Beep put not the .wav file. (I added the Sleep command just to separate the beeps; the problem is the same either way.) It's accessing the .wav file, since if I rename it I get an error message.

The laptop has the latest version of the Microsoft Visual C++ redistributable installed. Is there something else that's missing?

Viewing all articles
Browse latest Browse all 27417

Latest Images

Trending Articles



Latest Images

<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>