Members

Technology Zones

IBM Learning Center

Articles

Hosted By

MaximumASP

Info

Rated
Read 263,478 times

Contents

Related Categories

Build an MP3 Player - Building the Form

Building the Form

To begin, create a standard Visual Basic project. Next, select Projects | Components from the menu bar, and select Windows Media Player in the resulting dialog box. Click OK to add the component to your project. Now, select it from the Toolbox and drop it onto the default form. We'll use the component's built-in user interface for all the standard features like play, pause and stop. Resize the Media Player OCX as necessary, as shown in Figure B.

Figure B: We'll use the Windows Media Player for built-in features such as playing, pausing and stopping MP3 playback.

Adding controls

As we mentioned, in addition to playing MP3 files, we want the application to read and write certain information about each song--otherwise known as tag information. As an added bonus, we'll retrieve the file length and calculate the current playing time. To do so, however, we'll need to add a few more controls to our form. Use Figure A as a template for dropping in the appropriate controls. To display the MP3 tag information, add seven textboxes named as follows: txtTitle, txtArtist, txtAlbum, txtYear, txtComment and txtGenreCode. In addition, drop in a combobox called Combo1, two command buttons named cmdOpen and cmdWriteTage, a directory, drive and filelist box, a timer control and two labels named lblTotalTime and lblElapsedTime. All other controls can retain the standard VB assigned names.

Change the FileListBox's Pattern property to *.mp3 so that it displays only MP3 files. Finally, alter the label controls to read Total Time and Elapsed Time. Set the Timer control's Interval property to 60. If you want, you can add several additional labels beside the textboxes and name them as we have.

© 2001 Element K Journals, a division of Element K Press LLC ("Element K"). Element K and the Element K logo are trademarks of Element K LLC

Comments

  • Lyrics support

    Posted by AziMo on 07 Jan 2008

    hey there...does anyone know the way a media player with lyrics support??

     

    thanx!! 

  • Re: TW 2000

    Posted by possible181 on 03 Jun 2007

    Anyone one plz help me with mediaplayer's iserviceprovider and how to program remoting mediaplayer

  • WMP.DLL VB.net media player master

    Posted by Qwazimoto on 08 Nov 2006

    Hi people I have written a few media players and a few turned out good(most were crap thaugh).
    If any one wants any help, Id be glad to.

    My media player im working on now has the followin...

  • Re: [62] Build an MP3 Player

    Posted by KoA on 24 Oct 2006

    Can someone help me?

    First, im getting Object does not support this this methor or property on ".Filename = Filename"
    Next, im getting the same thing for for the 2 options in the timer?
    ...

  • Posted by mazdak_zp on 23 Sep 2005

    when you want to get then path of a FileListBox or DirListBox, if it returns a folder in drive it return for example "c:\windows" without "\" at the end if path. but if the path was a drive it returns...