can anyone give a sample code for applying sounds on vb..
thanks.. i already applied a code but it wont work..

Public MTime As Byte

MMControl1.FileName = App.Path & "\music\Music.mid"

Private Sub Timer4_Timer()
MTime = MTime + 1
If MTime = 113 Then
ShutYerNoise
Play
MTime = 0
End If
End Sub

Sub Play()
MMControl1.Command = "Open"
MMControl1.Command = "Play"
Timer4.Enabled = True
End Sub


Sub ShutYerNoise()
MMControl1.Command = "Stop"
MMControl1.Command = "Close"
Timer4.Enabled = False
End Sub

what's wrong with this?..anyone?

Recommended Answers

All 3 Replies

First of all, you declared MTime as Byte when you're using it as an integer. Secondly, why not just use the Timer event instead of MTime?

Private Sub Form_Load()
MMControl1.Command = "Open"
MMControl1.Command = "Play"
End Sub

Private Sub Timer1_Timer()
MMControl1.Command = "Stop"
MMControl1.Command = "Close"
MMControl1.Command = "Open"
MMControl1.Command = "Play"
End Sub

Ok..thanks..i'm already done with it...=)

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.