Results 1 to 6 of 6

Thread: Problem with mp3 player

  1. #1

    Thread Starter
    Member
    Join Date
    May 2006
    Posts
    35

    Problem with mp3 player

    Hello All i want to make a mp3 player in vb6.I want to make it like when you click file1 the mp3 start playing.
    I have written this code in the File1:
    Private Sub File1_Click()
    Media1.open File1.FileName

    End Sub
    And the error that the machine gives me say
    Run-Time error '438'
    Object doesn't support this property or method

    What do i need ?
    I am a noob

  2. #2
    PowerPoster Keithuk's Avatar
    Join Date
    Jan 2004
    Location
    Staffordshire, England
    Posts
    2,236

    Re: Problem with mp3 player

    It depends on which media player you are using. With Wmp.dll its
    VB Code:
    1. WindowsMediaPlayer1.URL = App.Path & "\Your.mp3"
    This will load and play the file.

    I'm not sure your code will work because your only showing a FileListBox. You will need a DirListBox to find the path to this file.
    Keith

    I've been programming with VB for 25 years. Started with VB4 16bit Pro, VB5 Pro, VB6 Pro/Enterprise and now VB3 Pro. But I'm no expert, I'm still learning.

  3. #3

    Thread Starter
    Member
    Join Date
    May 2006
    Posts
    35

    Re: Problem with mp3 player

    I use windows media 10
    the error left but it still not play the song.It say ready i press the button to start and nothing happen
    but i thank you very much for your help

    p.s i copy-paste it
    i have put and a drive list box and a directory

  4. #4
    Fanatic Member dark_shadow's Avatar
    Join Date
    Feb 2005
    Location
    Igloo
    Posts
    900

    Re: Problem with mp3 player

    why not use a common dialog control ?
    go to the components then look for micrsoft common dialog control
    name it cdl and put this code in the button to open the song

    VB Code:
    1. cdl.Filter = "Audio Files(*.mp3,*.wma,*.wav,*.midi)|*.mp3;*.wav;*.wma;*.midi
    2. cdl.DialogTitle = "Open File"
    3. cdl.ShowOpen
    4. Me.WindowsMediaPlayer1.URL = (cdl.FileName)

  5. #5

    Thread Starter
    Member
    Join Date
    May 2006
    Posts
    35

    Re: Problem with mp3 player

    thanx Dark_Shadow

  6. #6
    PowerPoster Keithuk's Avatar
    Join Date
    Jan 2004
    Location
    Staffordshire, England
    Posts
    2,236

    Re: Problem with mp3 player

    Thats the simple way using a CommonDialog. I thought you needed to use a FilelistBox because you've shown one.
    Keith

    I've been programming with VB for 25 years. Started with VB4 16bit Pro, VB5 Pro, VB6 Pro/Enterprise and now VB3 Pro. But I'm no expert, I'm still learning.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width