wav file only works once

JohnM

Well-known member
Joined
Jul 2, 2004
Messages
116
Location
Massachusetts
Programming Experience
1-3
I select from a datagrid. This shows a label with a button, it also triggers a wav file that rings. I then click on a button that hides the label along with the button. I immediately go back to select another thing from the data grid. It shows the label and button, but doesn't ring. When I don't hide the label and button, it rings.

Any idea why this happens?

Thank you for your time.

John M
 

JohnM

Well-known member
Joined
Jul 2, 2004
Messages
116
Location
Massachusetts
Programming Experience
1-3
Neal thanks for your reply.
The code below works, it allows it to ring each time I go back and select from a datagrid and then click on this button. But when I add to this code the following:
btnsend.hide and the label: lblinvoice.hide (the label the button is on) it rings just once. (I want the lbl and button to hide when the the send button is clicked.)
When I go back to select from the datagrid (this triggers the label.show and button.show) and click the send button it doesn't ring.

If you need the code that doesn't work I can redo it and post it.

Thanks John

Sub btnSend_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnSend.Click
Dim Soundinst As New Soundclass

Const SND_Async As Integer = &H1

Const SND_Filename As Integer = &H20000

Soundinst.PlaySound("c:\SoundFile\cashreg1.wav", SND_Async)

End Sub

 

JohnM

Well-known member
Joined
Jul 2, 2004
Messages
116
Location
Massachusetts
Programming Experience
1-3
here's code that makes it ring just once

Neal said:
Do you have some code to share so we can help?
Neal, here is the code that makes it ring only once.
Thanks for your time.

John M

Private Sub btnSend_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnSend.Click
Dim Soundinst As New Soundclass

Const SND_Async As Integer = &H1

Const SND_Filename As Integer = &H20000

Soundinst.PlaySound("c:\SoundFile\cashreg1.wav", SND_Async)

lblInvoice.Hide() " adding this and "

btnSend.Hide() " adding this makes it ring only once"

End Sub

 
Top Bottom