Search

Rss Posts

Rss Comments

Login

 

Creating a Mp3 Player In VB.net 2008 (Express \ Standard)

Aug 16

A Mp3 player is a hard task, but if you plan to use the Windows Media Player Controls it becomes so much easier, and so much quicker. In this tutorial I shall show you how to build your own basic Mp3 Player. Of course this is not going to oust great clients such as Winamp and Foobar2000, but it’s a good way to get to know using custom COM elements.

Ok let’s get started before I get to sleepy! Open up VB.net (Express Edition is fine) and now click File – New Project. In the new window that shows click Windows Form Application and type the project name to be Mp3Player

image

Click OK. Now in the toolbox (if the toolbox is not showing go to View – Toolbox) right click and select Choose Items from the right click menu. In the new ‘Choose Toolbox Items’ window that shows click the COM Components tab and then scroll down until you find the ‘Windows Media Player’ Control. Click the tickbox next to the name of the control

image

Click OK. Now in the general section of your Toolbox you should have a element called ‘Windows Media Player’ Drag this element onto your application. Depending on your Windows Media Player version you should get something that looks like the below image

image

Now to make things easier for creating your application move the element to the bottom of your application. Because the user won’t see the media player it’s not important about the size of location. It’s at this point you might find it nicer to slightly enlarge the application window (you can do this by clicking on one of the corners of the application and dragging it out). We now need to add a listbox. This will be our playlist editor, where the user will be able to add songs to play. You can add a listbox from the toolbox common controls area. Give this listbox full width of your application and leave above 15\20% at the top of your app. Make sure the listbox is selected then in the right hand (default position) properties section rename the listbox to ‘playlist’. In the properties section Anchor to Top, Left, Bottom and Right!

image

Your application should some what like the above image by this stage. We now need to allow the user to import files to the listbox. This is probably the most complex code of a mp3 player, and still it’s still rather basic code! Drag a button (from toolbox – Common controls) onto your application. Give this button a name of import and a text value in the properties to ‘Import’. You should also Anchor this button to Top, Right. Now once again from the toolbox drag OpenFileDialog from the Dialogs section. Don’t worry nothing will show up on your main application but you will see something like what shows below.

open

Click this button once to bring up the properties in the right menu for the dialog. Rename it importdiag and change the value multiselect to true. In the filter section of the properties for importdiag type the following:

Mp3 Music|*.mp3

The above will make sure the user can only select Mp3 files. Now double click on the ‘Import’ button you created earlier. This should take you into code view. Make sure your mouse cursor is within the Private Sub import_click and then type

importdiag.ShowDialog()

This will in turn show a open file window that Windows will generate for us. It will only show if the user has clicked the import button. Making sure you still have the importdiag button still clicked on the right properties menu click the small lightning bolt. You should now see something somewhat like the below image.

Untitled-4

Double click on the item ‘FileOk’ (The actual text that says FileOK). You should now be in code view. Making sure your mouse is within the Private Sub importdiag_FileOk section, type the following code

For Each track As String In importdiag.FileNames
playlist.Items.Add(track)
Next

This code does the following: It goes though each one of the files the user selected and then adds it to our listbox. Because we’re only trying to create a simple Mp3 player we have not checked if the user is importing a valid filetype, but instead relying on the File Import window working in filtering to show on Mp3 tracks. Ok you can now test out importing Mp3 files. Press F5 to start debugging. Try important a collection of Mp3 files.

Now lets start to play these tracks! Add a button on your application and name it ‘play’, give it a text value of “Play”. Double click on this play button to enter the code view. Making sure your cursor is contained within Private Sub play_Click section type the following

AxWindowsMediaPlayer1.URL = playlist.SelectedItem

This calls our Windows media player item we added at the very start of the tutorial, and plays the selected item in the playlist. Add a new button to the application, this time call it stopbutton and have a text value of ‘Stop’. Double click the stop button and type the following code:

AxWindowsMediaPlayer1.Ctlcontrols.stop()

Once again add another button and this time call it pause with a text value of Pause. Double click it and in the code view type:

AxWindowsMediaPlayer1.Ctlcontrols.pause()

You can now open Mp3 files, play them, stop them and pause them. That’s it for this tutorial but on request I will go into more details with things such as track lengths, video playback and design. Let me know in the comments if you’d like that! I’d love to hear all your feedback! I’m off to bed now, I’m getting very sleepy!

Mp3player

Download The Source Code: Here

83 Comments

Add your comment

  1. Kofi
    Sep 16 at 12:42

    Thanks. You are good.

    How about other file types and videos.

  2. Kofi
    Sep 16 at 12:49

    Wonderful! I just wrote my first media player.

    Can you help with other file types and videos?
    I want to write a player that will play anything.

  3. Nitin
    Oct 02 at 14:10

    The mp3 is working very fine.
    i am trying to select next and previous track can you help me.

  4. Kyle Kinkade
    Oct 03 at 22:40

    Hey, Thanks a ton. I am very new at this, but what I did differently once I got to the end. I completely ignored the Play Pause and Stop buttons. What I did instead was go to the playlist event, and for MouseDoubleClick, placed your Playlist.URL = Playlist.SelectedItem

    The purpose of this though, was because I wanted to use the nicer look of the windows mediaplayer. Is there a reason that you preffered to hide it?

  5. Daryl
    Oct 14 at 12:30

    This tut was very helpfull thanks

  6. Michal
    Oct 15 at 22:01

    Great…Could you be so kind and tell me how to make video player .Thank you very much

  7. austin
    Oct 18 at 14:31

    me too i would like to see more of your stuff. this is pertty good my first media player

  8. Ardiano1
    Oct 19 at 16:44

    Nice…..THnx for thish Tuto…….

  9. scoolj
    Oct 23 at 20:57

    pls can u tell me the step to insert the button into a project.

  10. Dylan
    Oct 24 at 21:34

    dude i would suggest adding a save playlist button, if i find out how i’ll post how on here
    P.S. thank you

  11. Ash
    Oct 27 at 19:53

    Hey. Erm can you make the code work for importdiag.SafeFileNames as it wont play when this code is put instead of importdiag.FileNames ?
    Any Help >?<

  12. Slap
    Nov 09 at 01:34

    Nice tutorial, although I use a logitech USB headset to listen to music, how would I make this player able to locate different output sources and use them?

  13. rakesh
    Dec 28 at 03:10

    ya that was a really nice and easy to implement tutorial but I would also like to play other file types and videos please post those tutorials too

  14. snow
    Dec 28 at 10:19

    Well, thank you very much. Because I think the information about creating this audio player you wrote is in more details. Therefore, as new learners, we study it better.
    But now, I want to create the function of buttons, such as previous, next. At the same time, I need to design the trackbars of songs speed and the time.
    If you see my message and are not that busy, I want to turn to you for help. Thanks a lot. ^-^

  15. Dana Kayyali
    Jan 20 at 15:58

    Hi,
    please how can i add sound in form to vb.net express edition
    like clap

  16. Gingey
    Jan 22 at 00:03

    I have made this and followed your tutorial exept for some reason i cannot select multiple songs to add into the listbox so i have to do it one by one.

    Secondly – the pause button doesnt pause it, instead it stops the song so when the play button is pressed again it plays over.

    Please get back to me dan!

    Great tut btw, keep them coming!!

  17. Gingey
    Jan 22 at 00:05

    Great! Solved the pause problem!

    Now just to add a next, previous and sort that selection out!

    thanks again

  18. Gary Callaghan
    Jan 30 at 15:42

    Hey i was just wondering if i could post this tutorial on my forums ? Of course i will link the tutorial back to here for people to check out your site.

    Hope to hear from you soon

  19. wendel
    Feb 04 at 02:21

    hi, im just a beginner in programming, specially in vb codes.. and i want to xplore more, i’ve learned a lot specially this creating mp3 player.. thanxs a lot..

  20. alzain
    Feb 06 at 02:50

    Awsome man

  21. alzain
    Feb 08 at 01:47

    can you give the same codes for c##?

  22. alzain
    Feb 08 at 01:47

    sorry i mean c#

  23. jason isherwood
    Feb 19 at 08:01

    Nice little tut. Loved it. Problem I have, being new to coding, is how to turn it into a fully fledged executable file. So far I can only run it on VB 2008 through the debug function.

  24. Subodh Nehra
    Feb 20 at 22:41

    Cool. Have not tried it yet but what I see is pretty awesome.

  25. John
    Feb 21 at 22:51

    When Im at the Private Sub “import_click”, an error message appears when I debug.

    It says, ” ‘Items is not a member of ‘AxWMPLib.AxWindowsMediaPlayer’.

    I need an answer.

  26. Rob
    Feb 21 at 23:15

    under some of the subs containing the code “AxWindowsMediaPlayer1″ it should
    actually say: “AxWMPLib.AxWindowsMediaPlayer”
    because it doesn’t recognize the latter code. This was during my experience.

  27. jason
    Mar 04 at 02:36

    An error occurred creating the form. See Exception.InnerException for details. The error is: Could not find any resources appropriate for the specified culture or the neutral culture. Make sure “MyMP3Player.Player.resources” was correctly embedded or linked into assembly “MyMP3Player” at compile time, or that all the satellite assemblies required are loadable and fully signed.

    this is what i get. can anyone help me with this. pls!

  28. Rohan
    Mar 10 at 17:00

    I liked it.How do we print the name of the file excluding its directory

  29. Ddub
    Mar 17 at 19:22

    Great tutorial thanks a ton !

  30. mark
    Apr 01 at 11:56

    Anyone know if you can choose a specific time in a track you want start playing at?

  31. charles
    Apr 09 at 04:00

    thanks, this tutorial helped me a great deal not just for making an mp3 player but also for understand vb more in general

  32. Sinha
    Apr 09 at 13:24

    Great tut

  33. Kev
    Apr 10 at 15:37

    I have the same problem as Gingey when I press pause it just stops. How did you fix it?

    Great tutorial by the way (“,)

  34. Raj
    Apr 13 at 11:35

    Very good tutorial. However, I want to play to mp3 audio files (one of the audio file will be a metronome file for keeping the timing) at the same time and with individual controls. Can you help me with the code for doing that? I would greatly appreciate your help. Thanks!

    Raj.

  35. Paco
    Apr 19 at 17:55

    hey can you show me telling a progressbar that tells you how much the song is ok XD

  36. allan
    Apr 27 at 15:08

    Thank’s for the tutorial, worked great! Just wondering though if you can make a button that will remove the selected track from the playlist? If you or someone else knows how, feel free to share. Thanks.
    Allan.

  37. meedo
    Apr 30 at 11:29

    wonder ful ,but how we can proceed the same
    project without mediaplayer

  38. king
    May 05 at 06:14

    hi thnx it is nice tutorial

  39. David Botero
    May 27 at 19:45

    For other media types do this:

    Mp3 Music|*.mp3|Windows Media|*.wma

    What I want to know is how to make a pause and the continue playing.

  40. judy
    May 30 at 15:50

    i really thank you for this tut. i have vb project and i wanted to import that in it but i didn’t know how to do it. you’re an excellent programmer.

  41. max
    Jun 01 at 13:20

    the pause button doesnt work for me. Also is there away to just display the album and the name of the song instead of its entire directory ie categorize it.
    I would also like to know how to create the status of the song ie how long it has to play and also a next button and it automaticaly go to the next song

  42. Don
    Jul 03 at 03:14

    Thank you very much. You explained everything. Thanks

  43. Don
    Jul 03 at 03:14

    Thank you

  44. leon
    Jul 23 at 17:01

    NICE TUT, but you can play all music files if you by filter the next code type:

    music files|*.mp3;*.wav;*.wma

    sorry but my english. i speak better dutch.

    for more information email me l.p.kuipers@quicknet.nl

  45. Nexthazard
    Aug 01 at 19:25

    Nice Tut managed to Embed it into a browser i was working on ^^ um also where would i find more of your adv tuts ?

  46. Pricop Alexandru
    Aug 05 at 11:59

    Yea dude, nice tut, can u do for us a tutorial with video feature?? and also track bar and sound bar ;)

  47. abasaheb
    Aug 08 at 18:31

    i follwed your steps that u have given and i am now able to prepare a good media player………

    thanks!!!!

  48. NaeN
    Sep 02 at 08:42

    Thank you very very somuch bigmuch khayli much . very good explained.

  49. nan
    Sep 09 at 12:01

    nice tut, but can anyone tell me how can you automatically play the next song after the current song is finished? i was thinking about using the queue method but i don’t know how i will loop it. thanks in advance! oh yeah, i’m creating a playlist 4 my player btw

  50. Andrew
    Sep 10 at 17:16

    i really thank you for this tut. just wondering though if you can make a button that will remove the track from the playlist?

  51. Ikmet
    Oct 05 at 21:01

    Nice from you. Please help us code for usig track bar and sound bar.

  52. Jason
    Oct 13 at 15:36

    Great Tut but I`m at a loss as to how to play multiple tracks.

  53. Duckii
    Oct 14 at 09:30

    @ Andrew, I agree. Some of the music that may be added may not be wanted. Now I’m rather new to VB, but I’ve been doing it in ITM, so I understand a few basic things of it. I also agree with nan, A constant stream of music would be very cool.

    Yes, When you hit the pause button, it does screw up. Although I do not regulary pause my music, I may need to do it some times :D . To do that, it’d be a Else If statement or something? I’ll figure it out soon enough.

    There is another thing with it. You can add an infinite number of tracks, repeatedly. Maybe have like.. a one track thing..? Im not sure how you would do that.

    For John. This would be because you have put the code in the wrong spot. It should go in your importdiag section. :)

    Thanks :D

  54. arun
    Nov 07 at 07:24

    after importing songs to listbox it shows the whole path ……………….
    i want that only name of the song is copied can you help me in this regard …………
    thanx 4 the tutorial

  55. Jon
    Dec 02 at 20:44

    Id like to see more of your tutorials Post them!

  56. Malraux
    Dec 04 at 10:57

    Thanks for the tutorial. My problem: The Pause botton acts just like the Stop.

  57. shivraj rathod
    Jan 25 at 16:30

    hi
    thanks yaar but how to paly from the location it has been stoped

  58. Eben
    Jan 27 at 20:20

    thanks for the tutorial, i got the next and previous sorted out, but have one problem, i new at vb and dont a lot about it, i was wondering how to get the highest index number in the playlist as i need this if i keep on pressing the previous button, if i select the 1st song and press previous it needs to play the last song again. so i need to know how to get the highest index number. If anyone needs help on the previous and next button you can ask me on ebenderoock91@gmail.com

  59. Rohit
    Feb 02 at 02:39

    How can you link this with a progress bar so that it will show how muck has played?

  60. jiahanz
    Feb 18 at 11:16

    What to do for the pause button, its working like the stop button.

  61. Frankie
    Mar 08 at 06:05

    hey thx great tut i just wanted to know if their was a code to make the playlist switch to the next song automaticly get back to me thx :D

  62. Hedi
    Mar 09 at 00:02

    Thank you for taking time, providing the tutorial, and helping others learn something new!!!

  63. Mitesh Shere
    Apr 04 at 11:42

    Thanks I fond that code over the website but i found it from your site, Thank you Very much

  64. roxana
    May 22 at 12:50

    very helpful
    :*

  65. salisu
    Jul 13 at 09:37

    I really like it, though i m new in VB.NET but i made perfectly and i m dreaming to become a professional in VB.net of which i believe with people like you is very possible.

  66. Jessie
    Aug 15 at 23:42

    I can’t seem to figure out how to make it play the next song automatically once it reaches the end of the current one. Could you perhaps help me out with that?
    Thanks in advance,

    -Jessie

  67. gagan
    Aug 18 at 06:29

    very usefull information.
    thanx…

  68. kaboyish
    Sep 17 at 10:28

    you are the MAN. thanks a bunch.i am a beginner at this and you have helped me a great deal, that’s for sure.
    just wanted to ask whether you have other tutorials for making simple applications. just email them to me if possible. kaboyish@gmail.com
    thanks again

  69. Arjun
    Sep 19 at 08:52

    Hi man,awesome work,this is my first mp3 player and it was useful to me.It would be better if you tell us how to design an video player using vb…

  70. hemant solanki
    Sep 19 at 17:13

    i want to make vb.net mp3 plyr but it must play online……how can i do this?

  71. Anaya Upadhyay
    Sep 20 at 02:01

    Fulfilled my request.

  72. Pearintosh Inc.
    Sep 27 at 15:22

    I Already Know This, I Need Track Lenths And The Ability To Drag My Mouse Across The Toolbar To Change The Track Lenth. Thankyou

    With Great Thanks,
    Faizan Abbas (Owner Of Pearintosh Inc.)

  73. luk707
    Oct 06 at 14:20

    hell yeah im sleepy make it mor like itunes abit of gloss (no devices like ipods obviously) thanks anyway

  74. vaso
    Oct 24 at 17:01

    sorry but i have done all these and i did not here music.

    how can i load music to this mp3 player

    sorry for the bad english….i am greek

  75. Eric Chai
    Oct 31 at 13:39

    Bingo I love the way you code the MP3 Player. It really helps me a lot in my project. Can you add the delete song button as well to remove the unwanted song from the list ?

  76. Julita
    Nov 03 at 07:45

    thanks a lot for the tutorial, i’ve create it in vb.net 2005. but the pause button doesn’t working?

    i’m wondering how to make the more complicate music player in vb.net, just like the application for radio broadcasting.

    and the application can connect to internet. ex. can show comments from the web in the application.

    waiting 4 the next tutorial, JiaYou!!

  77. Faizan Abbas
    Nov 04 at 19:44

    All I Need To Know Is How To Use A Progessbar To Track The Progress Of The Song. Please Teach Me This… It Is Very Important…

  78. Skyler
    Dec 07 at 02:50

    Its not working for me please help!

    I debugg and I get this error code:
    —— Build started: Project:DJ Cisco Music Player, Configuration: Debug Win32 ——
    Compiling…
    DJ Cisco Music Player.cpp
    c:\documents and settings\owner\my documents\visual studio 2008\projects\dj cisco music player\dj cisco music player\Form1.h(136) : error C2065: ‘importdiag’ : undeclared identifier
    c:\documents and settings\owner\my documents\visual studio 2008\projects\dj cisco music player\dj cisco music player\Form1.h(136) : error C2228: left of ‘.ShowDialog’ must have class/struct/union
    type is ”unknown-type”
    c:\documents and settings\owner\my documents\visual studio 2008\projects\dj cisco music player\dj cisco music player\Form1.h(137) : error C2143: syntax error : missing ‘;’ before ‘}’
    c:\documents and settings\owner\my documents\visual studio 2008\projects\dj cisco music player\dj cisco music player\Form1.h(138) : error C2065: ‘For’ : undeclared identifier
    c:\documents and settings\owner\my documents\visual studio 2008\projects\dj cisco music player\dj cisco music player\Form1.h(138) : error C2146: syntax error : missing ‘;’ before identifier ‘Each’
    c:\documents and settings\owner\my documents\visual studio 2008\projects\dj cisco music player\dj cisco music player\Form1.h(138) : error C2065: ‘Each’ : undeclared identifier
    c:\documents and settings\owner\my documents\visual studio 2008\projects\dj cisco music player\dj cisco music player\Form1.h(138) : error C2146: syntax error : missing ‘;’ before identifier ‘track’
    c:\documents and settings\owner\my documents\visual studio 2008\projects\dj cisco music player\dj cisco music player\Form1.h(138) : error C2065: ‘track’ : undeclared identifier
    c:\documents and settings\owner\my documents\visual studio 2008\projects\dj cisco music player\dj cisco music player\Form1.h(138) : error C2146: syntax error : missing ‘;’ before identifier ‘As’
    c:\documents and settings\owner\my documents\visual studio 2008\projects\dj cisco music player\dj cisco music player\Form1.h(138) : error C2065: ‘As’ : undeclared identifier
    c:\documents and settings\owner\my documents\visual studio 2008\projects\dj cisco music player\dj cisco music player\Form1.h(138) : error C2146: syntax error : missing ‘;’ before identifier ‘String’
    c:\documents and settings\owner\my documents\visual studio 2008\projects\dj cisco music player\dj cisco music player\Form1.h(138) : error C2146: syntax error : missing ‘;’ before identifier ‘In’
    c:\documents and settings\owner\my documents\visual studio 2008\projects\dj cisco music player\dj cisco music player\Form1.h(138) : error C2275: ‘System::String’ : illegal use of this type as an expression
    c:\windows\microsoft.net\framework\v2.0.50727\mscorlib.dll : see declaration of ‘System::String’
    c:\documents and settings\owner\my documents\visual studio 2008\projects\dj cisco music player\dj cisco music player\Form1.h(138) : error C2065: ‘In’ : undeclared identifier
    c:\documents and settings\owner\my documents\visual studio 2008\projects\dj cisco music player\dj cisco music player\Form1.h(138) : error C2146: syntax error : missing ‘;’ before identifier ‘importdiag’
    c:\documents and settings\owner\my documents\visual studio 2008\projects\dj cisco music player\dj cisco music player\Form1.h(138) : error C2065: ‘importdiag’ : undeclared identifier
    c:\documents and settings\owner\my documents\visual studio 2008\projects\dj cisco music player\dj cisco music player\Form1.h(139) : error C2228: left of ‘.FileNames’ must have class/struct/union
    type is ”unknown-type”
    c:\documents and settings\owner\my documents\visual studio 2008\projects\dj cisco music player\dj cisco music player\Form1.h(139) : error C2146: syntax error : missing ‘;’ before identifier ‘playlist’
    c:\documents and settings\owner\my documents\visual studio 2008\projects\dj cisco music player\dj cisco music player\Form1.h(139) : error C2065: ‘playlist’ : undeclared identifier
    c:\documents and settings\owner\my documents\visual studio 2008\projects\dj cisco music player\dj cisco music player\Form1.h(139) : error C2228: left of ‘.Items’ must have class/struct/union
    type is ”unknown-type”
    c:\documents and settings\owner\my documents\visual studio 2008\projects\dj cisco music player\dj cisco music player\Form1.h(139) : error C2228: left of ‘.Add’ must have class/struct/union
    c:\documents and settings\owner\my documents\visual studio 2008\projects\dj cisco music player\dj cisco music player\Form1.h(139) : error C2065: ‘track’ : undeclared identifier
    c:\documents and settings\owner\my documents\visual studio 2008\projects\dj cisco music player\dj cisco music player\Form1.h(141) : error C2146: syntax error : missing ‘;’ before identifier ‘Next’
    c:\documents and settings\owner\my documents\visual studio 2008\projects\dj cisco music player\dj cisco music player\Form1.h(141) : error C2065: ‘Next’ : undeclared identifier
    c:\documents and settings\owner\my documents\visual studio 2008\projects\dj cisco music player\dj cisco music player\Form1.h(141) : error C2143: syntax error : missing ‘;’ before ‘}’
    Build log was saved at “file://c:\Documents and Settings\Owner\My Documents\Visual Studio 2008\Projects\DJ Cisco Music Player\DJ Cisco Music Player\Debug\BuildLog.htm”
    DJ Cisco Music Player – 25 error(s), 0 warning(s)

    Hope you can read it. Also heres all of the code:
    #pragma once

    namespace DJCiscoMusicPlayer {

    using namespace System;
    using namespace System::ComponentModel;
    using namespace System::Collections;
    using namespace System::Windows::Forms;
    using namespace System::Data;
    using namespace System::Drawing;

    ///
    /// Summary for Form1
    ///
    /// WARNING: If you change the name of this class, you will need to change the
    /// ‘Resource File Name’ property for the managed resource compiler tool
    /// associated with all .resx files this class depends on. Otherwise,
    /// the designers will not be able to interact properly with localized
    /// resources associated with this form.
    ///
    public ref class Form1 : public System::Windows::Forms::Form
    {
    public:
    Form1(void)
    {
    InitializeComponent();
    //
    //TODO: Add the constructor code here
    //
    }

    protected:
    ///
    /// Clean up any resources being used.
    ///
    ~Form1()
    {
    if (components)
    {
    delete components;
    }
    }

    protected:

    private: System::Windows::Forms::Panel^ panel2;
    private: System::Windows::Forms::ListBox^ listBox1;
    private: AxWMPLib::AxWindowsMediaPlayer^ axWindowsMediaPlayer1;
    private: System::Windows::Forms::Button^ Import;
    private: System::Windows::Forms::OpenFileDialog^ openFileDialog1;

    private:
    ///
    /// Required designer variable.
    ///
    System::ComponentModel::Container ^components;

    #pragma region Windows Form Designer generated code
    ///
    /// Required method for Designer support – do not modify
    /// the contents of this method with the code editor.
    ///
    void InitializeComponent(void)
    {
    System::ComponentModel::ComponentResourceManager^ resources = (gcnew System::ComponentModel::ComponentResourceManager(Form1::typeid));
    this->panel2 = (gcnew System::Windows::Forms::Panel());
    this->listBox1 = (gcnew System::Windows::Forms::ListBox());
    this->axWindowsMediaPlayer1 = (gcnew AxWMPLib::AxWindowsMediaPlayer());
    this->Import = (gcnew System::Windows::Forms::Button());
    this->openFileDialog1 = (gcnew System::Windows::Forms::OpenFileDialog());
    this->panel2->SuspendLayout();
    (cli::safe_cast(this->axWindowsMediaPlayer1))->BeginInit();
    this->SuspendLayout();
    //
    // panel2
    //
    this->panel2->Controls->Add(this->listBox1);
    this->panel2->Controls->Add(this->axWindowsMediaPlayer1);
    this->panel2->Controls->Add(this->Import);
    this->panel2->Dock = System::Windows::Forms::DockStyle::Fill;
    this->panel2->Location = System::Drawing::Point(0, 0);
    this->panel2->Name = L”panel2″;
    this->panel2->Size = System::Drawing::Size(513, 397);
    this->panel2->TabIndex = 2;
    //
    // listBox1
    //
    this->listBox1->FormattingEnabled = true;
    this->listBox1->Location = System::Drawing::Point(0, 29);
    this->listBox1->Name = L”listBox1″;
    this->listBox1->Size = System::Drawing::Size(513, 316);
    this->listBox1->TabIndex = 2;
    //
    // axWindowsMediaPlayer1
    //
    this->axWindowsMediaPlayer1->Dock = System::Windows::Forms::DockStyle::Bottom;
    this->axWindowsMediaPlayer1->Enabled = true;
    this->axWindowsMediaPlayer1->Location = System::Drawing::Point(0, 349);
    this->axWindowsMediaPlayer1->Name = L”axWindowsMediaPlayer1″;
    this->axWindowsMediaPlayer1->OcxState = (cli::safe_cast(resources->GetObject(L”axWindowsMediaPlayer1.OcxState”)));
    this->axWindowsMediaPlayer1->Size = System::Drawing::Size(513, 48);
    this->axWindowsMediaPlayer1->TabIndex = 1;
    //
    // Import
    //
    this->Import->Location = System::Drawing::Point(0, 0);
    this->Import->Name = L”Import”;
    this->Import->Size = System::Drawing::Size(75, 23);
    this->Import->TabIndex = 0;
    this->Import->Text = L”Import “;
    this->Import->UseVisualStyleBackColor = true;
    this->Import->Click += gcnew System::EventHandler(this, &Form1::Import_Click);
    //
    // openFileDialog1
    //
    this->openFileDialog1->FileName = L”importdiag”;
    this->openFileDialog1->Filter = L”Mp3 Music|*.mp3″;
    this->openFileDialog1->Multiselect = true;
    this->openFileDialog1->FileOk += gcnew System::ComponentModel::CancelEventHandler(this, &Form1::openFileDialog1_FileOk);
    //
    // Form1
    //
    this->AutoScaleDimensions = System::Drawing::SizeF(6, 13);
    this->AutoScaleMode = System::Windows::Forms::AutoScaleMode::Font;
    this->ClientSize = System::Drawing::Size(513, 397);
    this->Controls->Add(this->panel2);
    this->Name = L”Form1″;
    this->Text = L”DJ Cisco Music Player”;
    this->panel2->ResumeLayout(false);
    (cli::safe_cast(this->axWindowsMediaPlayer1))->EndInit();
    this->ResumeLayout(false);

    }
    #pragma endregion
    private: System::Void Import_Click(System::Object^ sender, System::EventArgs^ e) {importdiag.ShowDialog()
    }
    private: System::Void openFileDialog1_FileOk(System::Object^ sender, System::ComponentModel::CancelEventArgs^ e) {For Each track As String In importdiag.FileNames
    playlist.Items.Add(track)
    Next
    }

    };
    }

    PLEASE HELP ME!!! Thanks :)

  79. Lee
    Jan 05 at 23:47

    thanks For your help dude..

  80. guna
    Jan 10 at 04:48

    very i work the way to develop my own mp3 player

  81. Annonymous
    Jan 23 at 00:14

    Just Make it so you can see the player and show Mp3 Music|*.mp3|WMA Music|*.WMA|AVI video|*.AVI|WMV Video|*.WMV|MPEG|*.mpg in the file filter. It works. I tried it. You can add a lot of file types.

  82. Joseph
    Jan 29 at 06:54

    it works, thx
    But what I want to know is how to remove the filepath of the file so when I add songs, the whole C:\My Documents\ … doesnt appear . . . can you help?

  83. Joseph
    Feb 27 at 14:59

    you know how to make next and previous buttons?

Post a comment