Library tutorials & articles
Build an MP3 Player
By ElementK Journals, published on 14 Jul 2001
Page 4 of 6
- Introduction
- Building the Form
- Tag Information
- Playing a File
- Playing Time
- Wrapping Up
Playing a File
Up to this point, we have yet to explain how to play an MP3 file. Believe it or not, playing the file is actually the easiest part of this process. To do so, you set the Media Player's FileName property to the file you want to play. That's all there is to it! From this point, you use the media player's built-in buttons to control playing. Listing C shows the code we created for our application.
Listing C: Opening the file
Private Sub cmdOpen_Click() With MediaPlayer1 If Not FileOpen Then .FileName = FileName .AutoStart = False cmdOpen.Caption = "Close" Else .FileName = "" cmdOpen.Caption = "Open" End If End With End Sub
Notice that after setting the FileName property, we chose not to have it start playing automatically, so we set the AutoStart property to False. The code in Listing A stored the currently selected file location in the FileName variable.
Related articles
Related discussion
-
Key_Press() event for text box
by Aquila (1 replies)
-
Rename all kind of files and medias!
by jakefrog (0 replies)
-
Regarding Visual Basic Programme
by manjunathsl2007 (0 replies)
-
how do you hide all in VB6
by CapnJack (1 replies)
-
Problem with Input File
by novavb6 (3 replies)
Comments
Leave a comment
Sign in or Join us (it's free).