I am new to VB coding so I'm trying some easy projects.

I figured an alarm clock would be a good place to start. But I'm Having a hard time with the MP3 Part of it all.

I want a pre-selected MP3 to start, when my timer2 is = to the time of day.

But i Have never really used MP3's in any project. So dose anyone know how i would go about.

A. Adding a MP3 to the coding in the background and then.
B. Calling on it when the alarm goes off.

A. use Microsoft Multimedia Control. find this control on component.
add this code to play mp3 file :

Private Sub PlaySound()
      On Error GoTo ErrMsg
         AxMMControl1.Wait = True
         AxMMControl1.FileName = "D:\test.mp3"
         AxMMControl1.Command = "Open"
         AxMMControl1.Command = "Play"
         Exit Sub
         ErrMsg:
         MsgBox(Err.Description)
   End Sub

B. just call procedure name

Edited 6 Years Ago by Jx_Man: n/a

Hello,
I can't find the multimedia control on VS 2008 Pro !!

are you sure it's there?

Thanks

Hi,

Looks like the .Net MultiMediaControl isn't for free, look here.

What you can do is add the Windows mediaplayer control.

put this in the function:

AxWindowsMediaPlayer1.URL = "e:\music\Wanksta.mp3"
AxWindowsMediaPlayer1.Visible = False

and if you want to stop:

AxWindowsMediaPlayer1.close()

AxWindowsMediaPlayer1 is a COM component. this component you can add in the ToolBox whit right click and choose component.

I hope this helps

This article has been dead for over six months. Start a new discussion instead.