This project is one of those 28 hour build things where you get the task at noon one day and have to have a working demo up-and-running by teatime the next, ready for presentation. It's a popular competition pastime amongst hobbyists as it takes up a weekend and fills it with hurry; sometimes business people do it as well as they think it sharpens them up and makes them competetively fit. Hmmm.


So, the task.


" Starting out with a blank Visual Basic Form and a clutch of MP3 files (doesn't matter what the files are as long as they are MP3) make a simple MP3 player that can play, stop, and pause. You should be able to skip to the next and revert to the previous track in a playlist which is user-buildable from files stored anywhere on the machine on which the application is working. Once a playlist is built, it should be able to be saved and reloaded as required. Some attempt at an aesthetically pleasing interface should be made."

Visual Basic 2010

A Simple MP3 Player Made in Visual Basic.

Go Back vbmp3

Well it does say "some attempt at an aesthetically pleasing interface". It doesn't say it has to be a good one. Up above you can see the interface whilst Smetna's "Vltava" is playing, or rather isn't because the pause is on and that's why the button's red. Here's a bit of a film:

In the film up there you saw the VBMP3 in action and saw a list box, some buttons, a few shapes and a menu strip. There are in fact some hidden components. So, what we need to do now is to look at those components.


The first thing I did here was to crank out a form with the dimensions 461 in width and 407 in height and then set the back colour (BackColor in the properties window) to black. Then we need to drag the unseen components on to the form. Here they are:



bottom stuff

OpenlistDialog and importdialog are both open file dialogue boxes. OpenlistDialog is what you saw in the video when a playlist was loaded in, importdialog when a list was being built. SavelistDialog is a save file dialogue box and was what you saw when "beethoven 6th" was saved. Timer1 is of course a timer and monitors the player status, and MenuStrip1 provides the host for the playlist functions. We need not worry about the code yet as we can't really apply it until we get the objects on the form and the menu fleshed out anyway. The form consists of a few objects


The control panel consists of a background of three layered rounded rectangles. Rectangles can be found in the Visual Basic PowerPacks of your toolbox and you make the first one, set the back colour to whatever you want it to be and the radius to 50, or however round you wish. Copy this rectangle, paste it in to the form, and make the back colour of the new rectangle black. Paste in another instance of the original rectangle, so now you have two silver (or whatever colour) and one black rectangle.

Move the black rectangle over the original silver, and then resize it to fit inside leaving a silver border. Take the second silver rectangle and place it over the black, resizing so that you end up with a black border. Now alter the following properties of the second silver rectangle:

controlback properties

You don't actually have to worry about the radius. As you resize the rectangle the radius will extrapolate from the original.


Now make a copy of all three rectangles and paste it in to make the faux-speaker effect. Place it where you want it and set the middle rectangle to Percent20.


Next we need to put in the control buttons. They are all bog-standard buttons with the back colour set to silver, and the font set to Marlett to produce the symbols. Going from left to right on the buttons (i.e "Last" to "Next") the text you need to type in is: 3,  7, 5, n, 4 and the symbols will appear.


The text over the buttons is made of labels, one for each, with the text to reflect the action of the button, Last, Play, Pause etc. and the fore colour is set to white.


The decorative text is just two labels with text set to whichever font style and colour you like, and the remaining ones are the playlist, which is a listbox, and two buttons marked "Build List" and "Hide All".


There is another unseen, and it is this unseen that decodes the MP3 files. It is in fact an unseen and embedded version of Windows Media Player, which

we can control using the buttons we've just made.



Windows Media Player (WMP) is found on the toolbox under components like so:


although the chances are, if you are using the default installation toolbox, that you won't see it there because on setup not all components are loaded into the toolbar. You can choose which components and objects you want in there; the idea is you dump the ones you never use and keep the ones you do and that way you don't end up with a toolbox that's miles long. So if it isn't there, you need to add it to your toolbox. Right-click on the title marked components to bring up the following:


Look four down from the top and you'll find the sub-menu "Choose Items".

Left-click on "Choose Items" and you'll find the following tabbed box coming up:

choose items More >