Search - Articles
DevASP.NET for ASP.NET, VB.NET, XML and C# (C-Sharp) Developers Tuesday, March 03, 2009
Dev Articles
Search Directory
SQL Server

How to Create Media Player in VB.NET

Author: DevASP
Download Source Code : 304_Media

This article will guide you through the complete process of creating a media player just like in Windows Operating System (OS) by using Active X control provided by .NET Framework.

  • Steps you will have to do.
  • Start visual studio and create a new window application project.
  • Set the following properties of Form by using properties windows.

Text = Media Player, BoarderStyle = FixedSingle, maximizeBox  = False, Size = 298,298

Now right click on the toolbar and from the menu choose “Add/Remove Items”. A dialog box will appear choose the “COM Component” tab. Search for windows media player and check it by clicking in the checkbox. Click ok. Now in your toolbox a new item is added with the name of window media player.


  • Drop this to your form and set the following properties.

Name = player, Size = 298,250


  • Drop a main menu control to build the menu for media player
  • Build the menu in the following hierarchy and set there names as shown in parenthesis.


   Open (open)

   Exit (mexit)



    Play (play)

    Stop (mstop)

     Pause (mpause)



     Up   (mup)

     Down (mdown)

     Mute (mmute)


  • From toolbox drop a “OpenFileDialogBox” control to your form.
  • Set its name to “opd”.
  • Open the code window and write the code as below in your code window.

Private Sub open_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles open.Click


   opd.InitialDirectory = "c:\"


   player.URL = opd.FileName


Catch ex As Exception

  MessageBox.Show("Some error occur so can't play media", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error)


End Try


End Sub


Private Sub mexit_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles mexit.Click




End Sub

Private Sub play_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles play.Click


End Sub

Private Sub mstop_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles mstop.Click




End Sub

Private Sub mpause_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles mpause.Click




End Sub

Private Sub mup_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles mup.Click


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


End Sub

Private Sub mdown_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles mdown.Click


        player.settings.volume = player.settings.volume - 10


End Sub

Private Sub mmute_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles mmute.Click


If player.settings.volume = player.settings.mute() Then


   player.settings.volume = 20




   player.settings.volume = player.settings.mute()


End If


End Sub

Article Comments
This really a very good Programm and very easy to make

Posted on 5/28/2006 5:56:37 AM by chandni Gupta

hi i have made the media player however when i search files it comes up will all files i just want the mp3,wave and files like them to come up.(ones that only play in windows media player). Can you please tell me the code so that my media player will work better. thanks

Posted on 12/12/2006 11:47:24 AM by jon

very simple to create and test and understand

Posted on 12/13/2006 1:08:36 AM by manu krishnan G

its nice and ammazing for me and it is very easly understandble code

Posted on 12/30/2006 3:21:24 AM by nagaraju

Hii may i know with what thing you made media player did you made with Visula study 2003 thank you and are those the code that you made with thank you very much

Posted on 1/9/2007 8:54:49 PM by nobthi

The article is realy good. In this code u are passing url that is perticular file name.
supose i want to pass perticular ip address and port number then what changes i shoule do?
can u reply please.

Posted on 1/22/2007 5:49:07 AM by manisha

This is Very easy to understand and easy to create. nice.

Posted on 1/23/2007 5:45:48 AM by D Prasad

I want to give the functionality of Forwarding the Songh and Revinding it....Cn u plz help me

Posted on 1/26/2007 2:21:14 AM by Rupinder

This article is excellent, for beginners.Thank you very much.

Posted on 3/8/2007 2:36:24 AM by sujaneesh

i want to require coding for simple player make i

Posted on 3/8/2007 11:40:45 PM by hardik

I want to play the .wmv file from a specified position in windows media player using, if any one knows please help.

Posted on 3/9/2007 7:04:49 AM by keerthy

The article is good.
In this code i want to play .mpeg4 or .AVI files in this media player

pl help me in this coding.

Posted on 3/19/2007 1:55:26 AM by vinay kumar goud

How can I retrieve a video from a ORDVideo data type stored in an Oracle database?
I would like to have a very simple windows application with a button (Open video), an instance of WMP. I know that I can't stream the video because I am using Windows 2003 Server (I am using XP) in my laptop. How can I re-build the file stored in my database so I can pass the file name to WMP?

Posted on 3/26/2007 4:52:59 PM by chlc1966

Now how can I create a media player in ASP.Net
I am working on my laptop which has Windows XP home edition, but the service is automatically installed with Visual studio, so I just would like to know how to create the enviroment to retrieve the video on the Web

Posted on 4/9/2007 1:36:23 AM by Carlos Henrique

I am so interested in your website especially about making karaoke by using source code of Please could you recommend me about this?

Posted on 5/4/2007 11:32:56 PM by KUY CHANTHA

your code is simple and easy to proud I managed to create my own media player. thank you

Posted on 5/10/2007 3:35:53 AM by makilya

it is really a nice coding and very easy to understand

Posted on 5/28/2007 12:44:39 AM by vibhor

I was making a media player that played songs off a server, that allowed you to skip tracks etc. The idea was that if i run the program @ college i can play any song i upload to my server. catch is they all have to name 1.mp3, 2.mp3 etc. but if any1 is interested email/msn me @ heres the program so far (its still under progress when this was submitted)

Posted on 5/28/2007 9:27:35 PM by Sean Thompson

Hi. Very nice code. But, how to add video player functions to it?

Posted on 6/4/2007 11:28:34 AM by Adro

Very nice. But, what does it mean if the Windows Media control comes up in the toolbox as 'disabled' ??

Posted on 6/8/2007 12:49:43 PM by Richard Bishop

Superb..! Easy to understand for beginners... Thanks a lot...!

Posted on 7/28/2007 11:53:17 AM by Sharfudeen

I just don't know what to say. This article has helped me a lot.
Please do keep up the good work.

Posted on 8/6/2007 11:34:08 PM by Eric

send me media player in resarch level project

Posted on 9/5/2007 5:17:29 AM by lalit

source code of media player with example

Source code of crystal report with example

Posted on 10/3/2007 2:15:33 AM by Partha Chatterjee

Very simple code but there is no code for the previous,next buttons and the play list.

Posted on 10/17/2007 9:41:46 AM by bongani

where bouts do i enter the code,

im a total noob.



Posted on 10/28/2007 6:14:44 PM by Krs

to forward:
another method to forward:
player.Ctlcontrols.currentPosition += 10
to go to specific time:
player.Ctlcontrols.currentPosition = 10

Posted on 11/9/2007 11:02:04 AM by hisham

How i read the songs lyrics
when songs play that lyrics alos will be shown in front of audio or vedio player.

Posted on 12/7/2007 10:19:15 AM by lalit

i have disgined wavw file player which plays wave files stored on my pc as per my selection. Can I play *.mp3 extension files in

Posted on 12/22/2007 9:06:30 AM by bhushan puranik

I want to know how we can create media player by using with examples.

Posted on 12/26/2007 11:07:18 PM by krishnadas

I want to know how we can create media player by using with examples.

Posted on 12/26/2007 11:07:20 PM by krishnadas

I want to know how we can create media player by using with examples.

Posted on 12/26/2007 11:07:24 PM by krishnadas

I can't clear understand this code can you explain more than

Posted on 1/6/2008 1:24:46 AM by shadi

thank u very much, it make my work very easy

Posted on 1/10/2008 5:18:30 AM by farooq

i want to pass specific ip address and port number then what changes i should do?

Posted on 1/25/2008 5:40:03 AM by Rahul

jeah !
i was looking for that for a while !!!
really simple to make and to understand

Posted on 1/27/2008 5:21:28 AM by joske vermeulen

can i do the same with files in the recources ???

Posted on 1/27/2008 5:22:00 AM by jos.

This really a very good Programm

Posted on 2/15/2008 5:20:43 AM by vishal verma

This really a very good Programm

Posted on 2/15/2008 5:31:08 AM by vishal verma

Good Work...

Posted on 3/15/2008 11:11:50 PM by Masroor Aijaz

Thank you

Posted on 4/9/2008 12:36:06 AM by Asif

Great coding. I've recently wanted to begin creating my own media player and this is what I was looking for. Thanks for the code. I now have the player working and will be able to continue to add to it...

Posted on 5/19/2008 3:37:03 PM by CJ

thanks lord

Posted on 5/21/2008 6:34:01 AM by gautam

Great job,
can you please tell me how to play .3gp or some other extention with this player?

Posted on 8/15/2008 2:59:31 AM by rahul namdev

Thanx for give me useful informations. I hope further about this article in future and solve my problems .................

Posted on 8/15/2008 4:25:18 AM by Rehan Qureshi

Thank you vary much.

Posted on 10/28/2008 7:43:59 AM by Nazmul Hasan

i have got many more idea about how to make media player. its really nice

Posted on 11/18/2008 4:34:46 AM by Vivek

I need to add logo in my video file
in this video file is separate
& my logo is separate
how can in mix this two separate file using VB
it can bee possible
can you send how it is possible

Thanks with regrad

Posted on 11/22/2008 4:28:38 AM by vasdev

its working but how i will access multimle video or audio files in playlist which will play one by one can u give some idea? please reply me.

Posted on 2/2/2009 4:23:03 AM by pronob saha

thanks 4 ur web ................. details

Posted on 7/30/2009 4:16:46 AM by anas

itz good to read your codes sir, i felt satisfied after studying codes
related to media player........
plz tell me how to create an option of Converting one format into another in an application as a control..........i would be your greatful....

Posted on 8/7/2009 9:08:55 AM by yogesh

can anyone help me..

im looking for code to send audio to different sound cards..

eg. i want to play audio1 through soundcard1 at the same time as audio2 is playing through soundcard2..

this is using different tabs in my media player..

i would be grateful for any help or ideas..

thanks in advance


Posted on 11/19/2009 7:47:16 PM by manz

vry simple coding and understand properly

Posted on 12/21/2009 4:36:01 AM by prashant punia

vry simple coding and understand properly. sir how how can convert file for mp3 to wave file and play d media

Posted on 12/21/2009 4:39:32 AM by prashant punia

How do i make a custom timebar for my media player? Using progressbar or something!

Posted on 12/31/2009 6:56:16 AM by Greaseddog

1.The media player in which tool we have use and how to identified the tool in the references.

2.can we use the control any one of the toolbox.Then which controls we use.

Posted on 1/6/2010 11:32:58 PM by shankar

The player worked very well but my worry is, the quality of the output was not all that good as compared to the Windows Media Player and other players. How can I overcome this problen. Can someone help please.

Posted on 1/14/2010 9:33:53 AM by John

I am trying to do following but not getting it . Please help
"I want to resize my player .It means if we strech window then display window should also gt streched"
I tried this command "Me.Size.Equals(player.Size)"

But not getting solution.
Please help me.

Posted on 1/14/2010 1:41:49 PM by Pradeep

its really nice code .............

Posted on 1/20/2010 4:52:41 AM by sanjay saurav

How can i make a 2D game using vb .net 2008?

Posted on 1/22/2010 5:50:44 AM by Ringo david

"Handles clause requires a WithEvents variable defined in the containing type or one of its base types" I get this error in every "Private Sub mmute_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles mmute.Click" can any1 plz help me and show a solution ?

Posted on 2/1/2010 12:14:56 PM by gunnsi

thnx for supporting

Posted on 2/7/2010 1:23:11 AM by gangstaa

hey. thank you so much. i was planning to make a gift for my boyfriend using and i'll put all of our songs in it. you helped me big time. ^^

Posted on 2/10/2010 1:47:06 AM by hush

how can i next and prev the tracks ???

Posted on 2/13/2010 1:47:26 AM by shrawan singh

This is very helpful article for me and my mates

Thanks for Sharing

Posted on 2/19/2010 4:26:13 AM by Manoj

its really nice code...
how can i add timer in this code so that media should play for some seconds and then stop..then after some time it should start again..
thanks in advance..

Posted on 2/23/2010 1:28:07 AM by shailaja

I want to create media player which is play all file format i.e audio,video file (.vob ,.amr,.mp4, etc...).
How create condition for all types.
plz help me !!!

Posted on 2/27/2010 1:10:53 AM by kedar

yeah! it is really valuable information to all of us who want to know these details....thank you very much.....

Posted on 3/5/2010 1:13:11 AM by samson

it is very useful for me. thanks for this .can u help me more to connect oracle database from

Posted on 3/5/2010 6:04:37 AM by shakir

Hi. I just knew it was not very difficult. But I really hoped that somewhere is any easy to understand information HOW TO use it in basics. Thanks a lot for your sample.

Posted on 3/5/2010 8:41:10 PM by goldengel

It's very easy understand and works perfectly. Thanks.

Posted on 3/10/2010 1:54:55 AM by Arun

this is a very useful and nice article to help me for mamaking a media player using

Posted on 3/14/2010 6:42:37 AM by kusumsiri

I feel it vary understandable code but how to let the music files or collection to media player list

Posted on 3/23/2010 3:01:27 AM by sanjubaba

im confused but the codes are correct???? but if you wanna be a pro do it from scrach like i do i can make the COM Component by myself its much easyr im a c++/cvb2008 FREAK soory im very picky with my codes. and once i deleted framework by accident

Posted on 4/6/2010 5:57:43 PM by VBfreak

how excellent this code is ! i can't describe . it has solved my problem very easily

Posted on 4/11/2010 4:42:19 AM by sudhir

the code is very easy
but i can't add player on this way..
plz somebody help me

Posted on 4/22/2010 2:32:40 AM by arpan

i try this code in c# but i there is confusion in open menu;
there is not work open directory and not able to select file.
tell me please what i do to select file as click on "open".....
i wait for ur ans.

Posted on 4/30/2010 6:54:58 AM by deep

Thanks for this code

Posted on 5/10/2010 1:21:11 AM by Rajan

its easy to understand..thank you...but can i know how to do next & prev button??? and also how to make the song A change to song B by ownself after song A finish???

Posted on 5/17/2010 4:45:06 AM by puva

it would like to know as I make to show a video in full screen but at the beginning of the video it could not appear the bar of commands (play, volume) in low of the video!

Posted on 5/26/2010 10:33:47 AM by flavian mayro xavier

Thank you verry much

Posted on 6/9/2010 6:17:43 AM by bier

media plarer codding in

Posted on 6/25/2010 3:14:27 AM by bharat patel

please help me wit code to make media player.

Posted on 6/29/2010 12:05:23 PM by Samuel Sesay

its very useful to me.., esy to understand also thank you vry much...

Posted on 7/1/2010 7:53:50 AM by sivaraj

plz it is urgent

Posted on 7/2/2010 10:29:32 AM by How to Create Media Player in c#.NET

Thanks its very helpful for me

Posted on 7/6/2010 12:58:59 AM by aung ko

How can I use a progressbar to see the progress of a song or video and be able to scroll through the media (like in windows media player).

Posted on 7/6/2010 8:25:06 AM by ud2008


Posted on 7/15/2010 2:17:11 AM by vikas

wow its so good to program in vb am doing project on online information system but how to do it

Posted on 8/1/2010 11:01:19 AM by moen

It is very good............
very easy to make media player with the help of it......
but it only import windows media player.......
i want to make new media player......
plz give idea......

Posted on 8/13/2010 1:26:59 PM by ankit

actually i have yet not tried ,but i hope that i will success.....

Posted on 8/19/2010 10:54:59 AM by sparsh

this is working and i hope this work very well

Posted on 8/21/2010 2:01:22 PM by sanjeev kumar

it's very useful to me ....... i searched this for long time thank u very much

Posted on 8/23/2010 1:38:26 PM by saravanan b

sir, it is really good it's work well :)

Posted on 8/27/2010 6:51:49 AM by ganesh yadav

hiiiiiiiii the code was to gud am unable 2 play all the video files can u plz send me the code which i can play any of the files in it.

Posted on 10/30/2010 12:38:41 AM by srilekha

Thanks for providing code, it's very easy.

Posted on 11/1/2010 3:05:37 AM by mm gehlot

Thank you very much for these simple, well understood, easy to read, excellent and wonderful codes. I really appreciate it.

Posted on 11/1/2010 10:52:08 PM by YangoTech

this is real good 2 me! thnx

Posted on 11/3/2010 4:21:04 AM by Lusubilo Mwakibinga

its very good program it is very simple and easy to make nice coding..thanks
But could me send the coding of text to voice converter plzzz.
Its very urgent i m waiting.............

Posted on 11/16/2010 12:36:11 AM by raj verma

thanks for the code!!
it's been great help to me!!!

Posted on 12/1/2010 2:55:21 AM by louie jay

Add Article Comment:
Name :
Email Address :
Comments :
<< Creating Print Screen Function using Window’s API’s

Disclaimer - Privacy
© 2002-2017