You are on page 1of 1

Voice Recorder in Visual Basic .

NET
Create a new form and add 3 button to your form and Rename the buttons as the following:
Record, Save and Play as shown below:

Go to the code page and add the following declaration: 

1. Private Declare Function record Lib "winmm.dll" Alias "mciSendStringA" (ByVal lpstrCommand A
s String, ByVal lpstrReturnString As String, ByVal uReturnLength As Integer, ByVal hwndCallback 
As Integer) As Integer  

Record Button Code

1. Private Sub Record_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles 
Button1.Click  
2.     record("open new Type waveaudio Alias recsound", "", 0, 0)  
3.     record("record recsound", "", 0, 0)  
4. End Sub  

Stop and Save Button Code

1. Private Sub Stop_and_Save_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) 
Handles Button2.Click  
2.     record("save recsound D:\Manish\mbp.wav", "", 0, 0)  
3.     record("close recsound", "", 0, 0)  
4. End Sub  

Play Button Code

1. Private Sub Play_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Bu
tton3.Click  
2.     My.Computer.Audio.Play("D:\Manish\mbp.wav", AudioPlayMode.Background)  
3. End Sub  

You might also like