0% found this document useful (0 votes)
26 views1 page

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

This document provides code to create a voice recorder in Visual Basic .NET using 3 buttons to record, save, and play audio. It includes code to declare functions to open and record a new audio file, save and close the recording, and play the saved audio file.

Uploaded by

Yem Madona
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
26 views1 page

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

This document provides code to create a voice recorder in Visual Basic .NET using 3 buttons to record, save, and play audio. It includes code to declare functions to open and record a new audio file, save and close the recording, and play the saved audio file.

Uploaded by

Yem Madona
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 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