title: Having trouble playing a wav file vb net
body: <p>I am using a function to return a string with the path of the *.wav file I would like to play.</p>
  
  <p>Here is the function used to determine which sound to play when the user clicks on something and etc...</p>
  
  <pre><code>Function GetSoundPath() As String
      Dim theme As String, appPath As String, soundPath As String
      theme = GetUserTheme()
      appPath = LCase(Application.StartupPath &amp; "\themes\" &amp; theme &amp; "\sounds\click.wav")
  
      Return soundPath
  
  End Function
  </code></pre>
  
  <p>The above function gets the correct path to the *.wav file needed to be played. The issue is that when I use my function with "My.Computer.Audio.Play(GetSoundPath)" I get an error speaking of:</p>
  
  <blockquote>
    <p>An error occurred creating the form. See Exception.InnerException for details.  The error is: The form referred to itself during construction from a default instance, which led to infinite recursion.  Within the Form's constructor refer to the form using 'Me.'</p>
  </blockquote>
  
  <p>I have checked the application.vb file and no references to my form as its name "wisealarm" was found. The form was referred to as "Me" as it should be. The even stranger thing is that when I manually type the path in the command it works without issue.. e.x. My.Computer.Audio.Play("c:\users\sound.wav")</p>
  
  <p>Any insight would be greatly appreciated. If any further code or details are needed please let me know. thanks.</p>