# CodeGuru Technical FAQs > CodeGuru Individual Visual Basic FAQs >  [2005] How do I Play Music from my program?

## HanneSThEGreaT

Three of the most common methods used to play music from within your program are the following

*Q:* How do I play music?

*A:* Option 1:


```
    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        'Works in 2003 and 2005
        'Process
        Dim MyProcess As New Process
        MyProcess.StartInfo.FileName = SoundFileName
        MyProcess.StartInfo.WindowStyle = ProcessWindowStyle.Hidden
        MyProcess.Start()
    End Sub
```

   Option 2:


```
Imports System.Runtime.InteropServices 'for api

     _
Private Shared Function PlaySound(ByVal lpszName As String, ByVal hModule As Int32, ByVal dwFlags As Int32) As Int32
    End Function 'PlaySound API

    Private Const SND_FILENAME As Integer = &H20000

    Private SoundFileName As String 'sound file name & location

    Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
        'Works in 2003 and 2005
        'API ( PlaySound )
        PlaySound(SoundFileName, 0, SND_FILENAME)
    End Sub

    Private Sub Form1_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
        SoundFileName = "C:\WINDOWS\MEDIA\chimes.wav"
    End Sub
```

   Option 3:


```
    Private Sub Button4_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button4.Click
        'Works in 2005 ONLY
        'My Object
        My.Computer.Audio.Play(SoundFileName, AudioPlayMode.Background)
    End Sub
```

----------

