Try this!
vb.net Code:
Public Class Form1
Private Declare Function mciSendString Lib "winmm.dll" Alias "mciSendStringA" (ByVal lpstrCommand As String, ByVal lpstrReturnString As String, ByVal uReturnLength As Integer, ByVal hwndCallback As Integer) As Integer
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Button1.Enabled = False
Button2.Enabled = True
mciSendString("open new Type waveaudio Alias recsound", "", 0, 0)
mciSendString("record recsound", "", 0, 0)
Label1.Text = "Recording..."
Label1.Visible = True
End Sub
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
Button1.Enabled = True
Button2.Enabled = False
Button3.Enabled = True
SaveFileDialog1.ShowDialog()
mciSendString("save recsound " & SaveFileDialog1.FileName, "", 0, 0)
mciSendString("close recsound", "", 0, 0)
MsgBox("File Created: " & SaveFileDialog1.FileName)
Label1.Text = "Stopped..."
Label1.Visible = False
My.Computer.Audio.Stop()
End Sub
Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click
SaveFileDialog1.ShowDialog()
Label1.Text = "Playing..."
Label1.Visible = True
My.Computer.Audio.Play(SaveFileDialog1.FileName, AudioPlayMode.Background)
End Sub
Private Sub Form1_Load(sender As System.Object, e As System.EventArgs) Handles MyBase.Load
Button1.Text = "Start"
Button2.Text = "Stop"
Button3.Text = "Play"
End Sub
End Class
Modified the original code so that it uses a save dialog.