In this method i am writing to the writer,
Private Sub waveIn_DataAvailable(ByVal sender As Object, ByVal e As WaveInEventArgs)
Try
If (Me.InvokeRequired) Then
Me.BeginInvoke(New waveIn_DataAvailable(AddressOf waveIn_DataAvailable), sender, e)
Else
If writer IsNot Nothing Then
writer.Write(e.Buffer, 0, e.BytesRecorded)
secondsRecorded = (writer.Length / writer.WaveFormat.AverageBytesPerSecond)
If (secondsRecorded >= 60) Then
StopRecording(sender)
End If
End If
End If
Catch ex As Exception
MsgBox(ex.Message)
End Try
End Sub
here, i am closing
Private Sub waveIn_RecordingStopped(ByVal sender As Object, ByVal e As EventArgs)
Try
If (Me.InvokeRequired) Then
Me.BeginInvoke(New waveIn_RecordingStopped(AddressOf waveIn_RecordingStopped), sender, e)
Else
waveIn.Dispose()
waveIn = Nothing
writer.Close()
writer = Nothing
End If
Catch ex As Exception
MsgBox(ex.Message)
End Try
End Sub