Media Player Tutorial in Visual Basic.Net

Tutorial ini akan menunjukkan cara untuk membuat program media player di NET visual basic.
Saya menggunakan Basic 2008 Express Edition Visual untuk tutorial ini.
Kami akan menambahkan satu kontrol yang tidak termasuk dalam toolbox:
Pada Toolbox: klik kanan mouse dan klik pada Pilih Produk


A Window will appear: Click on COM Components.
Scroll down to Windows Media Player and check it then click ok


In the toolbox, scroll down to the new control "Windows Media Player and drag it to the form: - See more at:

 

Resize it to fit the form like the picture below and make sure to leave a space between the icon and Windows Media Player: - See more at: 


Change some properties of the Windows Media Player. Right click on it and then click on properties. On the properties window, change the Anchor property to Top, Bottom, Left, Right. - See more at: 



That property will make Windows Media Player stretches to the whole window when the form size maximizes.
Add a button to the form and change it's text property to "Song":



Add OpenFileDialog to the form:
Right click on OpenFileDialog1 in the gray area and click on properties. Change it's Filter property to Music File|*.mp3
Add the "Song" Button Click Event:

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
OpenFileDialog1.ShowDialog()
AxWindowsMediaPlayer1.URL = OpenFileDialog1.FileName
End Sub
When you play the program, click on Song button and that should show you a Open File Dialog to choose a song. Make sure that the song is in mp3 format.

Sumber : 

0 Response to "Media Player Tutorial in Visual Basic.Net"

Posting Komentar