Play a wav file.

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • I Hate My Computer
    New Member
    • Mar 2007
    • 44

    Play a wav file.

    Hi, I am looking to play a wave file in visual basic. I would like it to play from the resource file. I have added the wave file but how do I get it to play? I do have this code.

    Code:
    Dim Sound As New System.Media.SoundPlayer()
    
    Sound.SoundLocation = “your path to the .wav file” ‘ex.: c:\mysound.wav
    Sound.Load()
    Sound.Play()
    Thanks
  • debasisdas
    Recognized Expert Expert
    • Dec 2006
    • 8119

    #2
    try using the system API ----- PlaySound

    Comment

    • Killer42
      Recognized Expert Expert
      • Oct 2006
      • 8429

      #3
      Originally posted by I Hate My Computer
      Hi, I am looking to play a wave file in visual basic. I would like it to play from the resource file. I have added the wave file but how do I get it to play?
      Can you explain what you mean by "the resource file", to make sure we're all on the same "wavelength "? The code you posted looks as though it's intended to play directly from the WAV file, not from a resource file.

      Comment

      • I Hate My Computer
        New Member
        • Mar 2007
        • 44

        #4
        Originally posted by Killer42
        Can you explain what you mean by "the resource file", to make sure we're all on the same "wavelength "? The code you posted looks as though it's intended to play directly from the WAV file, not from a resource file.
        I understand this but the resource file that is in VB is were I would like to play my sound from. The code I posted is for a file name but I want one that will play a sound in the resource file.

        Comment

        • Killer42
          Recognized Expert Expert
          • Oct 2006
          • 8429

          #5
          Originally posted by I Hate My Computer
          I understand this but the resource file that is in VB is were I would like to play my sound from. The code I posted is for a file name but I want one that will play a sound in the resource file.
          In that case, I think you had better tell us what version of VB you're using.

          Also, here's a Google search which may help.

          Comment

          Working...