Hello everybody!
I want when I click on some button, computer run some music file from specified path (for example C:\path) and to start playing music from this file but without running any programs, just like background of the program.
Thanks!
Printable View
Hello everybody!
I want when I click on some button, computer run some music file from specified path (for example C:\path) and to start playing music from this file but without running any programs, just like background of the program.
Thanks!
Try the mediaplayer control, it's very simple.
Sorry, where do you see 'mediaplayer' control in Visual Studio 2008?!
Go to Solution Explorer -> Add reference -> In the COM tab find Windows Media Player and add to the project. Next add this code:
Code:Public Class Form1
Dim player As WindowsMediaPlayer
Private Sub Form1_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
Dim player As New WindowsMediaPlayer
player.URL = path_to_the_file
End Sub
End Class
OK, this works. But, how to stop music in some moment?
Actually, when I click button I want that program stop reproducing song.
In the click event of your stop button add the following:
Code:player.Ctlcontrols.stop()
@wearcm, when I type your code program tell me following error:
Object variable or With block variable not set.
:cry::cry::cry: