
Net Framework 2.0 and up you can use the My keyword instead of this P/Invoke method: My.('C:\path\to\wav\file.wav') Or you can play a system specific sound: My. TextBox1.Text = CStr(Val(TextBox1. sound.Play() // default is to play asyncronously. Plus button and less button put this in our coude (In VB.NET code, Beep can be called as if it's a global method.). Notice that sndPlaySound makes use of a wait parameter. TextBox2.Text = Trim(say(CInt(TextBox1.Text)))Īnd we turn to button2 same as the button1,we're using handle click events or double click, to call function moudle "sndPlaySound", we call the name to play the soundĬall sndPlaySound(path(1) + "Sounds\" & arr(i) + ".wav", SND_NOSTOP) wav sound files, you can call the PlaySound API in WINMM. The most general version that applies to all VBA uses an API function sndPlaySound. How to: Play Sounds in Visual Basic How to: Play System Sounds in Visual Basic HowTo: Play the system sounds in Visual Basic 2008 Visual Basic Tutorial Play. In the main form we choose the button1, we're using handle click events or double click button1,to call Using the code is very simple, you have to choose if you want to play a file: Sound.PlayWaveFile('Filename.wav'), an embedded resource: Sound.PlayWaveResource('Embedded.wav'), or a system sound: Sound.PlayWaveSystem('SystemExit').


#VB.NET PLAY SOUND MOD#
Public Function say(ByRef Value As Integer) As StringĬase 14 To 19 : say = say(Value Mod 10) & " teen" Here, you will find the way to play embedded resources, external files, or Windows system Waves.
