How to Play MP3 Files in Visual Basic 6.0

Written by jason candanedo
  • Share
  • Tweet
  • Share
  • Pin
  • Email
How to Play MP3 Files in Visual Basic 6.0
Playing MP3 files in VB 6.0. (music image by Markus Götze from Fotolia.com)

Visual Basic has internal classes that easily assist you in coding audio applications. Media Player is a Windows application that can be used in Visual Basic to play audio, such as audio files in the MP3 format. Media Player contains DLL (dynamic link libraries), which are included in Microsoft's programming products. This means that you can drag and drop objects that play music without numerous lines of code.

Skill level:
Moderate

Other People Are Reading

Things you need

  • Visual Basic 6.0
  • Media Player
  • MP3 file

Show MoreHide

Instructions

  1. 1

    Open up your Windows project in the Visual Basic editor. Double-click the form to have it open in the design viewer. You need to add the Media Player object to the project since it is not loaded into the toolbar automatically.

  2. 2

    Right-click on the toolbar and choose the "Add/Remove Items" option. This will open up a new window box with a list of tools. Click on the "COM Components" tab, then go down to the option box entitled "Windows Media Player." Place a check in this the box, then click "OK."

  3. 3

    Drag and drop the Media Player tool from the toolbar into the Visual Basic form. Input "myMedia" into the "Name" property for the Media Player tool, then double-click on the icon to open the code view.

  4. 4

    Assign the MP3 music file to the component. The following code will play the song "mySong.mp3" using the Media Player component: Me.myMedia.URL = "mySong.mp3."

  5. 5

    Press the "F5" key after saving the form. "F5" runs the code in the debugger that tests the application. "F5" is used to make sure that the new code compiles and plays the song within the visual Basic application.

Don't Miss

Filter:
  • All types
  • Articles
  • Slideshows
  • Videos
Sort:
  • Most relevant
  • Most popular
  • Most recent

No articles available

No slideshows available

No videos available

By using the eHow.co.uk site, you consent to the use of cookies. For more information, please see our Cookie policy.