0

Me and a friend are making an app which we need to play a sound when Form1 is started. How do we do this? I don't mind code.

2
Contributors
2
Replies
3
Views
7 Years
Discussion Span
Last Post by W1ND0W5
0

The following code will play .wav files.

Public Class Form1

    Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        Dim myCoolSoundFile As String = "C:\!vb.net\mission2.wav" '// your sound .wav file here.
        If IO.File.Exists(myCoolSoundFile) Then
            My.Computer.Audio.Play(myCoolSoundFile)
        Else
            MsgBox("No sound file found.", MsgBoxStyle.Critical)
        End If
    End Sub
End Class
0

OK, will try that later.

Thank you!

Edited by W1ND0W5: n/a

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.