title: Audio Recording in vb.net
body: <p>help me I want to make a program that record mic in vb.net I got this code but I cant save audio on different location</p>
  
  <pre><code>Imports System.Runtime.InteropServices
  Public Class Form1
  'Dim recording As Boolean = False
  Dim Filez As String = "C:\rec.mp3"
  
  &lt;DllImport("winmm.dll")&gt;
  Private Shared Function mciSendString(ByVal command As String, ByVal buffer As String, ByVal bufferSize As Integer, ByVal hwndCallback As IntPtr) As Integer
  End Function
  
  Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
      mciSendString("open new Type waveaudio Alias recsound", "", 0, 0)
      mciSendString("record recsound", "", 0, 0)
      Button1.Text = "Stop"
  End Sub
  
  Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
      My.Computer.Audio.Play(Filez)
  End Sub
  
  Private Sub Button3_Click(sender As Object, e As EventArgs) Handles Button3.Click
      mciSendString("save recsound " &amp; Filez, "", 0, 0)
      mciSendString("close recsound ", "", 0, 0)
      Button2.Enabled = True
  End Sub
  End Class
  </code></pre>
  
  <p>When i change path of Filez for save at another place it show error <a href="https://i.stack.imgur.com/HA3J6.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/HA3J6.png" alt="Error Image is Here"></a></p>
  
  <p>Please help </p>