G
Guest
I am using the filestream feature in VB.NET to create a file. However, I am not able to delete or overwrite the file until the app closes down. I am using the .Close( ) method on the filestream right after it is created. I am creating a .BMP file from an OLE Object of an Access database field. After creating the .BMP file, I read it back into a System.Drawing.Image object (in order to display the bitmap on my form), using the " FromFile('c:\sign.bmp')" method (and have also used " = New Bitmap('c:\sign.bmp')" as well). It is this command that puts some kind of lock on the file - with that remarked out, I can do anything with the file I want to. Here is a code snippet
----------------------------------------------------------------
Dim imgSignature As System.Drawing.Imag
Dim imgData() As Byt
imgData = dr.Item("StudentSign"
Dim fs As New FileStream("c:\sign.bmp", FileMode.Create, FileAccess.ReadWrite, FileShare.ReadWrite
fs.Write(imgData, 0, UBound(imgData)
fs.Close(
fs = Nothin
picSignature.Image = imgSignature.FromFile("c:\sign.bmp"
imgSignature = Nothin
----------------------------------------------------------------
Once that " = imgSignature.FromFile('c:\sign.bmp')" code is executed, the sign.bmp file is inaccessible (cannot be deleted either programatically or through Windows Explorer). I tried to use "imgSignature.Dispose()", and that caused argument errors just trying to start the application
Any ideas
- Thanks
JR
----------------------------------------------------------------
Dim imgSignature As System.Drawing.Imag
Dim imgData() As Byt
imgData = dr.Item("StudentSign"
Dim fs As New FileStream("c:\sign.bmp", FileMode.Create, FileAccess.ReadWrite, FileShare.ReadWrite
fs.Write(imgData, 0, UBound(imgData)
fs.Close(
fs = Nothin
picSignature.Image = imgSignature.FromFile("c:\sign.bmp"
imgSignature = Nothin
----------------------------------------------------------------
Once that " = imgSignature.FromFile('c:\sign.bmp')" code is executed, the sign.bmp file is inaccessible (cannot be deleted either programatically or through Windows Explorer). I tried to use "imgSignature.Dispose()", and that caused argument errors just trying to start the application
Any ideas
- Thanks
JR