Load sound from created folder

If you need help with a project or need to know how to do something specific in VB.NET then please ask your questions in here.
Forum rules
Please LOCK your topics once you have found the solution to your question so we know you no longer require help with your query.
5 posts Page 1 of 1
Contributors
User avatar
boyd
New Member
New Member
Posts: 20
Joined: Sat Oct 23, 2010 9:10 pm

Load sound from created folder
boyd
I created a folder with name audio and i put 1 sound in it (i don't want to put the sound in resources :D :D )
in the mouse enter event i want to put a code to play my sound
with images work :
Code: Select all
 me.backgroundimage=image.fromfile("..\..\audio\sound.wav") 
But how cam i make with sound?
User avatar
mandai
Coding God
Coding God
Posts: 2585
Joined: Mon Apr 26, 2010 6:51 pm

Re: Load sound from created folder
mandai
You can use the Windows Media Player COM control:
Code: Select all
    Dim wmp As WMPLib.WindowsMediaPlayer = New WMPLib.WindowsMediaPlayer()

    Private Sub PictureBox1_MouseMove(ByVal sender As System.Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles PictureBox1.MouseMove
        If wmp.playState <> WMPLib.WMPPlayState.wmppsPlaying Then
            wmp.URL = "..\..\audio\sound.wav"
        End If

    End Sub
User avatar
boyd
New Member
New Member
Posts: 20
Joined: Sat Oct 23, 2010 9:10 pm

Re: Load sound from created folder
boyd
I don't what in this way
It's possible in other way? without WMP?
User avatar
CleverBoy
VIP - Donator
VIP - Donator
Posts: 395
Joined: Mon Dec 06, 2010 8:29 pm

Easy to play sound from folder : ( No Loop )
Code: Select all
 My.Computer.Audio.Play("c:\music folder\mouse.wav", AudioPlayMode.WaitToComplete)
to play sound for ever ( Loop ) :
Code: Select all
        My.Computer.Audio.Play("c:\music folder\mouse.wav", AudioPlayMode.BackgroundLoop)
Note : Change the music location between " and ",, the location that i put only example and it wont work

if i help you Give "Thanks" for me plus +Rep
Thanks

-CleverBoy
Code'N'Stuff
OneTeam..OneDream
Join ABSplash Team & Earn $$
ABSplash Site - Workpad - (VB) Custom Buttons 2 ways
User avatar
boyd
New Member
New Member
Posts: 20
Joined: Sat Oct 23, 2010 9:10 pm

Re: Load sound from created folder
boyd
That's the code i'm looking for.....THX CleverBoy wahooo; wahooo; wahooo; wahooo;
It works perfectly
5 posts Page 1 of 1
Return to “Coding Help & Support”