08 October 2013

How to create Window Media Player using vb.net

Before I have posted How to create folder lock and unlock using vb.net And How to Send G-mail using vb.net Today I will show you How to create Window Media Player using vb.net.

1. Create new form like picture below
2. Choose Toolbox "Window Media Player" to Draw on your form and Name it as "player"
3. Choose Toolbox "MenuStrip" to Draw on your form and follow by video below.
4. Choose Toolbox "OpenFileDialog" then select on anywhere of your form and Name it as "opd"


5. Copy Code below
- Double click on "OpenToolStripMenu" and paste code below

Try
   opd.InitialDirectory = "c:\"
   opd.ShowDialog()
   Player.URL = opd.FileName
   player.Ctlcontrols.play()
   Catch ex As Exception
     MessageBox.Show("Some error occur so can't play media", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error)
End Try


- Double click on "ExitToolStripMenu" and paste code below

Application.Exit()

- Double click on "PlayToolStripMenu" and paste code below

player.Ctlcontrols.play()

- Double click on "PauseToolStripMenu" and paste code below

player.Ctlcontrols.pause()

- Double click on "StopToolStripMenu" and paste code below

player.Ctlcontrols.stop()

- Double click on "VolumnUpToolStripMenu" and paste code below

player.settings.volume = player.settings.volume + 10

- Double click on "VolumnDownToolStripMenu" and paste code below

If player.settings.volume > 10 Then
   player.settings.volume = player.settings.volume - 10
Else
  player.settings.volume = 0
End If


- Double click on "MuteToolStripMenu" and paste code below

If player.settings.mute = True Then
   player.settings.volume = 20
Else
  player.settings.mute = True
End If


6. Add new form "Project > Add window Form > About Box" then Click Ok
Double Click on "AboutToolStripMenu" and paste code below

Aboutbox1.show()

Watch video



*** Note : If u have any problem please post your comment below I will solve it for u.



SamnengIT © 2014-2015SamnengIT