Object Disposed Exception - After using Stream.CLose

wina

New member
Joined
Aug 24, 2006
Messages
4
Programming Experience
Beginner
HAi.... I got this problem.... When I wanna close the application, There's an error occur saying "ObjectDisposedException". Even If I close the application through Task MAnager. Seems it start to occur when I used the Stream.Close() line, is there any trick that I can handle this exception?

Private Sub MenuExit_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MenuExit.Click
Application.Exit()
End Sub

Private Sub MenuProcess_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MenuProcess.Click
Dim Stream1 As Stream
Dim BarisArray As Byte()
'Open the stream
Stream1 = File.OpenWrite("\Storage Card\audio\DataIn.Wav")
m_Recorder = New OpenNETCF.Multimedia.Audio.Recorder
m_Recorder.RecordFor(Stream1, 1, SoundFormats.Mono16bit22kHz)
If m_Recorder.Recording = True Then
m_Recorder.Stop()
Label1.Text = "Finish"
Stream1.Close() 'Close the stream
End If
'Open the stream
Stream1 = File.OpenRead("\Storage Card\audio\DataIn.Wav")
ReDim BarisArray(Stream1.Length - 1)
Stream1.Read(BarisArray, 0, Stream1.Length)
Label2.Text = "Readable"
'Close the stream
Stream1.Close()
End Sub


Thanks.....
Wina
 
Back
Top