This may have been answered before i am not sure, i am running Visual Studio 2005 beta, i would like to know how i can play a sound file in the background when someone opens a form. Any ideas
I am using the my.computer.audio.play function to play an alert.
The alert is the result of checking a database for new entries every 10 seconds. If there is a new entry that the software has not seen yet, it uses the VBPower Tools Notification Window to pop-up a message.
What I want this to do is play the audio at that same time.
My problem is, I am unable to get audio to play inside of a timer's tick event handler.
Does anyone have any suggestions on how I can get audio to kick off inside that routine
yeah sorry about that, i have recently solved it, but thank you very much if you hadn't had given the small snippet of code i would be still wondering about it. Thanks!
stop the audio when the form visibility changes to hidden then something like this should work.
[code language=
"vb"]
Private
Sub Form1_VisibleChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.VisibleChanged If Me.Visible = False Then My.Computer.Audio.Stop() End If
End
Sub
[/code]
For
course if your using another approach to playing the audio (using the
System.Media.SoundPlayer) you can put
in the stop method line in place of the my.computer.audio.stop method.
Sorry to be a annoying, But do you know how i can stop the sound from playing when i make the form visible = false i haven't been able to work that part out yet!
I'm not able to find a reference to this myself, but this is a good question. How do you create a system event sound in windows and then invoke it What's more efficient for playing a wav with your application...invoking a system event sound or just doing the my.computer.audio.play
i have followed the link but there are no mention of anything to download or anything like that. I have tried some of the coding found of the page, for example
I'm not able to find a reference to this myself, but this is a good question. How do you create a system event sound in windows and then invoke it What's more efficient for playing a wav with your application...invoking a system event sound or just doing the my.computer.audio.play
Playing a sound file
Dean S.
I am using the my.computer.audio.play function to play an alert.
The alert is the result of checking a database for new entries every 10 seconds. If there is a new entry that the software has not seen yet, it uses the VBPower Tools Notification Window to pop-up a message.
What I want this to do is play the audio at that same time.
My problem is, I am unable to get audio to play inside of a timer's tick event handler.
Does anyone have any suggestions on how I can get audio to kick off inside that routine
Thanks!
Chris
MrZkitten
Dim s As New System.Media.SoundPlayer(filename)
s.Load()
s.Play()
jagadisha
Thanks!
Andrew
pradjini
What error message do you get Keep in mind that SoundPlayer only supports wav files, no mp3...
Andreas Masur
VB.NET 2005
Top play an audio file. Extremely simple
using the new My functionality.My
.Computer.Audio.Play("c:\windows\media\chime.wav")My
.Computer.Audio.Stop()To
stop the audio when the form visibility changes to hidden then something like this should work.[code language=
"vb"]Private
Sub Form1_VisibleChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.VisibleChanged If Me.Visible = False Then My.Computer.Audio.Stop() End IfEnd
Sub[/code]
For
course if your using another approach to playing the audio (using theSystem.Media.SoundPlayer) you can put
in the stop method line in place of the my.computer.audio.stop method.harolds
But do you know how i can stop the sound from playing when i make the form visible = false
i haven't been able to work that part out yet!
zgueney
I'm not able to find a reference to this myself, but this is a good question. How do you create a system event sound in windows and then invoke it What's more efficient for playing a wav with your application...invoking a system event sound or just doing the my.computer.audio.play
Thanks
Ted Wagner
http://www.trwagner.org
http://www.hanggup.com
AngryRichard
media.soundplayer
but it always returns an error message
invc
Think I found it:
My
.Computer.Audio.PlaySystemSound()Ted Wagnerhttp://www.trwagner.org
http://www.hanggup.com
Tommy Williams - MSFT
say i have a wav file in my documents
what do i place in the brackets between s.load() and s.play()
Sorry i am completely new to this level of coding!
*George*
What about System.Media.
SystemSounds.Beep.Play();or just System.Media.SystemSounds.Beep() in VB
KrazyMGA
http://forums.microsoft.com/msdn/ShowPost.aspx PostID=50999
nuAnonymous
media.soundplayer
i may be typing something wrong i don't any help would be good!
Error 1 'SoundPlayer' is a type in 'Media' and cannot be used as an expression
dicksters