473,395 Members | 1,745 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

When I get the image from the file the file remains locked

When I get the image from the file the file remains locked so the Delete
fails with a "used by another process"

So I tried using a clone and disposing the obtained image.

But that didn't fix the problem.

Can you help?

Dim zz As Image = Image.FromFile(imageFileName)

MyImage = zz.Clone

zz.Dispose()

zz = Nothing

File.Delete(imageFileName)
Jan 17 '06 #1
19 2208
hi,
the problem here with cloning method is it also copies the reference
of the file that is loaded in the IMAGE object so that if you dispose
the zz object after cloning, it passes reference of the file to MyImage
object that's why ultimately the file remains locked.

try this code. this should solve your problem

Dim fs As New StreamReader("C:\all.jpg")
Dim img As Image = Image.FromStream(fs.BaseStream)
fs.Close()
PictureBox1.Image = img
File.Delete("C:\all.jpg")
Lucky

Jan 17 '06 #2

I'd really like to know if this works. The Kodak Image drivers in Windows
98 and NT4 have the same problem. I always thought this was a bug in the
Kodak drivers, but if it exists in .NET (which doesn't use the Kodak
drivers) as well, then the problem may actually be in the underlying Win32
API.

Mike Ober.

"Lucky" <tu************@gmail.com> wrote in message
news:11**********************@o13g2000cwo.googlegr oups.com...
hi,
the problem here with cloning method is it also copies the reference
of the file that is loaded in the IMAGE object so that if you dispose
the zz object after cloning, it passes reference of the file to MyImage
object that's why ultimately the file remains locked.

try this code. this should solve your problem

Dim fs As New StreamReader("C:\all.jpg")
Dim img As Image = Image.FromStream(fs.BaseStream)
fs.Close()
PictureBox1.Image = img
File.Delete("C:\all.jpg")
Lucky


Jan 17 '06 #3
well first you need to understand the behaviour of the class and the
way it treats the resources.

in your case IMAGE class lock the resources so that if any call for
refresh/reload needs to attend by the object than the original data can
be reloaded or modified by the object itself.

i dont know why it is like this in IMAGE class but MS has implimented
it this way only.

run my code and compare it with your's and you'll see the difference
and behaviour of the class

Lucky

Jan 17 '06 #4
A bug, or a "feature"? I seem to recall a similar problem and found a
this reference that provided some insight.

http://support.microsoft.com/?id=814675

Cheers,
Randy

Michael D. Ober wrote:

I'd really like to know if this works. The Kodak Image drivers in Windows
98 and NT4 have the same problem. I always thought this was a bug in the
Kodak drivers, but if it exists in .NET (which doesn't use the Kodak
drivers) as well, then the problem may actually be in the underlying Win32
API.

Mike Ober.

"Lucky" <tu************@gmail.com> wrote in message
news:11**********************@o13g2000cwo.googlegr oups.com...
hi,
the problem here with cloning method is it also copies the reference
of the file that is loaded in the IMAGE object so that if you dispose
the zz object after cloning, it passes reference of the file to MyImage
object that's why ultimately the file remains locked.

try this code. this should solve your problem

Dim fs As New StreamReader("C:\all.jpg")
Dim img As Image = Image.FromStream(fs.BaseStream)
fs.Close()
PictureBox1.Image = img
File.Delete("C:\all.jpg")
Lucky


Jan 17 '06 #5
Thanks a lot

"Lucky" <tu************@gmail.com> wrote in message
news:11**********************@o13g2000cwo.googlegr oups.com...
hi,
the problem here with cloning method is it also copies the reference
of the file that is loaded in the IMAGE object so that if you dispose
the zz object after cloning, it passes reference of the file to MyImage
object that's why ultimately the file remains locked.

try this code. this should solve your problem

Dim fs As New StreamReader("C:\all.jpg")
Dim img As Image = Image.FromStream(fs.BaseStream)
fs.Close()
PictureBox1.Image = img
File.Delete("C:\all.jpg")
Lucky

Jan 17 '06 #6
" **Developer**" <RE*************@a-znet.com> schrieb:
When I get the image from the file the file remains locked so the Delete
fails with a "used by another process"


Check out the code snippets at
<URL:http://dotnet.mvps.org/dotnet/code/graphics/#ImageNoLock>.

--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://classicvb.org/petition/>

Jan 17 '06 #7
I don't think I can use your suggestion. I try to make it easy to see the
problem by shorting the code but I'm afriad I cut out too much code. Below
might be more then required to show the problem but I hope I didn't cut
anything relavent.

I believe the problen code starts where I left the blank lines below.

Dim wiaManager As WiaClass = Nothing ' WIA manager COM object

Dim wiaDevs As CollectionClass = Nothing ' WIA devices collection COM object

Dim wiaRoot As ItemClass = Nothing ' WIA root device COM object

Dim wiaPics As CollectionClass = Nothing ' WIA collection COM object

Dim wiaItem As ItemClass = Nothing ' WIA image COM object

Dim imageFileName As String

wiaManager = New WiaClass ' create COM instance of WIA manager

wiaDevs = wiaManager.Devices '

wiaDevs = wiaManager.Devices ' as CollectionClass; ' call Wia.Devices to get
all devices

If wiaDevs Is Nothing OrElse wiaDevs.Count = 0 Then

MessageBox.Show("No WIA devices found!", "WIA", MessageBoxButtons.OK,
MessageBoxIcon.Stop)

Application.Exit()

Return Nothing

End If

Dim selectUsingUI As Object = System.Reflection.Missing.Value ' = Nothing

wiaRoot = CType(wiaManager.Create(selectUsingUI), ItemClass) ' Display form
to let the user select device

If wiaRoot Is Nothing Then ' nothing to do

Return Nothing

End If

wiaPics = wiaRoot.GetItemsFromUI(WiaFlag.SingleImage,
WiaIntent.ImageTypeColor) 'Open acquisition form to get a single image.

If wiaPics Is Nothing Then

Return Nothing

End If

Dim wiaObj As Object = wiaPics.Item(0)

wiaItem = CType(Marshal.CreateWrapperOfType(wiaObj, GetType(ItemClass)),
ItemClass)

imageFileName = Path.GetTempFileName() ' create temporary file for image

wiaItem.Transfer(imageFileName, False) ' Now do the scan and then transfer
picture to our temporary file (only way to get it)

Dim zz As Image = Image.FromFile(imageFileName) ' create Image instance from
file

AcquireScanner = zz.Clone

zz.Dispose() 'Unlock the file

zz = Nothing

File.Delete(imageFileName)
When I get the image from the file the file remains locked so the Delete fails with a "used by another process" So I tried using a clone and disposing the obtained image. But that didn't fix the problem. Can you help?



Jan 17 '06 #8
Thanks, please see reply I just sent Lucky's first post
"Herfried K. Wagner [MVP]" <hi***************@gmx.at> wrote in message
news:ue**************@TK2MSFTNGP11.phx.gbl...
" **Developer**" <RE*************@a-znet.com> schrieb:
When I get the image from the file the file remains locked so the Delete
fails with a "used by another process"


Check out the code snippets at
<URL:http://dotnet.mvps.org/dotnet/code/graphics/#ImageNoLock>.

--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://classicvb.org/petition/>

Jan 17 '06 #9
What is the penalty for not deleting a temp file?

Is that a way to go?

"Herfried K. Wagner [MVP]" <hi***************@gmx.at> wrote in message
news:ue**************@TK2MSFTNGP11.phx.gbl...
" **Developer**" <RE*************@a-znet.com> schrieb:
When I get the image from the file the file remains locked so the Delete
fails with a "used by another process"


Check out the code snippets at
<URL:http://dotnet.mvps.org/dotnet/code/graphics/#ImageNoLock>.

--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://classicvb.org/petition/>

Jan 17 '06 #10
I tried deleting after I released wiaItem and wiaObj but the problem remains

I don't think I can use your suggestion. I try to make it easy to see the
problem by shorting the code but I'm afriad I cut out too much code. Below
might be more then required to show the problem but I hope I didn't cut
anything relavent.

I believe the problen code starts where I left the blank lines below.

Dim wiaManager As WiaClass = Nothing ' WIA manager COM object

Dim wiaDevs As CollectionClass = Nothing ' WIA devices collection COM
object

Dim wiaRoot As ItemClass = Nothing ' WIA root device COM object

Dim wiaPics As CollectionClass = Nothing ' WIA collection COM object

Dim wiaItem As ItemClass = Nothing ' WIA image COM object

Dim imageFileName As String

wiaManager = New WiaClass ' create COM instance of WIA manager

wiaDevs = wiaManager.Devices '

wiaDevs = wiaManager.Devices ' as CollectionClass; ' call Wia.Devices to
get all devices

If wiaDevs Is Nothing OrElse wiaDevs.Count = 0 Then

MessageBox.Show("No WIA devices found!", "WIA", MessageBoxButtons.OK,
MessageBoxIcon.Stop)

Application.Exit()

Return Nothing

End If

Dim selectUsingUI As Object = System.Reflection.Missing.Value ' = Nothing

wiaRoot = CType(wiaManager.Create(selectUsingUI), ItemClass) ' Display
form to let the user select device

If wiaRoot Is Nothing Then ' nothing to do

Return Nothing

End If

wiaPics = wiaRoot.GetItemsFromUI(WiaFlag.SingleImage,
WiaIntent.ImageTypeColor) 'Open acquisition form to get a single image.

If wiaPics Is Nothing Then

Return Nothing

End If

Dim wiaObj As Object = wiaPics.Item(0)

wiaItem = CType(Marshal.CreateWrapperOfType(wiaObj, GetType(ItemClass)),
ItemClass)

imageFileName = Path.GetTempFileName() wiaItem.Transfer(imageFileName,
False) Dim zz As Image = Image.FromFile(imageFileName) AcquireScanner =
zz.Clone
zz.Dispose() zz = Nothing
File.Delete(imageFileName)
When I get the image from the file the file remains locked so the Delete

fails with a "used by another process"

So I tried using a clone and disposing the obtained image.

But that didn't fix the problem.

Can you help?



Jan 17 '06 #11
What I mean
is the file there forever or does Window eventually delete it


" **Developer**" <RE*************@a-znet.com> wrote in message
news:OA*************@TK2MSFTNGP10.phx.gbl...
What is the penalty for not deleting a temp file?

Is that a way to go?

"Herfried K. Wagner [MVP]" <hi***************@gmx.at> wrote in message
news:ue**************@TK2MSFTNGP11.phx.gbl...
" **Developer**" <RE*************@a-znet.com> schrieb:
When I get the image from the file the file remains locked so the Delete
fails with a "used by another process"


Check out the code snippets at
<URL:http://dotnet.mvps.org/dotnet/code/graphics/#ImageNoLock>.

--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://classicvb.org/petition/>


Jan 18 '06 #12
i'm not sure when and how windows manages file in temp folder but
deleting files from code after use, is best practice.

Lucky

Jan 18 '06 #13

I still think it's a bug in the GDI itself. When you close the references
to an image using the COM interface, the image control should go away. It
doesn't - I know because I tested this heavily and finally discovered that
the only way to reliably "unlock" the file is to set the image to another
file first.

Mike.

"R. MacDonald" <sc****@NO-SP-AMcips.ca> wrote in message
news:43***********************@news.wanadoo.nl...
A bug, or a "feature"? I seem to recall a similar problem and found a
this reference that provided some insight.

http://support.microsoft.com/?id=814675

Cheers,
Randy

Michael D. Ober wrote:

I'd really like to know if this works. The Kodak Image drivers in Windows 98 and NT4 have the same problem. I always thought this was a bug in the Kodak drivers, but if it exists in .NET (which doesn't use the Kodak
drivers) as well, then the problem may actually be in the underlying Win32 API.

Mike Ober.

"Lucky" <tu************@gmail.com> wrote in message
news:11**********************@o13g2000cwo.googlegr oups.com...
hi,
the problem here with cloning method is it also copies the reference
of the file that is loaded in the IMAGE object so that if you dispose
the zz object after cloning, it passes reference of the file to MyImage
object that's why ultimately the file remains locked.

try this code. this should solve your problem

Dim fs As New StreamReader("C:\all.jpg")
Dim img As Image = Image.FromStream(fs.BaseStream)
fs.Close()
PictureBox1.Image = img
File.Delete("C:\all.jpg")
Lucky



Jan 19 '06 #14

Based on my experience with the Kodak drivers, you get an error when you
attempt to delete the file. Windows won't delete it later.

Mike Ober.

" **Developer**" <RE*************@a-znet.com> wrote in message
news:uL**************@TK2MSFTNGP10.phx.gbl...

What I mean
is the file there forever or does Window eventually delete it


" **Developer**" <RE*************@a-znet.com> wrote in message
news:OA*************@TK2MSFTNGP10.phx.gbl...
What is the penalty for not deleting a temp file?

Is that a way to go?

"Herfried K. Wagner [MVP]" <hi***************@gmx.at> wrote in message
news:ue**************@TK2MSFTNGP11.phx.gbl...
" **Developer**" <RE*************@a-znet.com> schrieb:
When I get the image from the file the file remains locked so the Delete fails with a "used by another process"

Check out the code snippets at
<URL:http://dotnet.mvps.org/dotnet/code/graphics/#ImageNoLock>.

--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://classicvb.org/petition/>




Jan 19 '06 #15
Thanks for the two replies.
Did you see Lucky's second post?
Sound reasonable to me.
How does it sound to you?


"Michael D. Ober" <obermd.@.alum.mit.edu.nospam> wrote in message
news:PU*****************@newsread1.news.pas.earthl ink.net...

Based on my experience with the Kodak drivers, you get an error when you
attempt to delete the file. Windows won't delete it later.

Mike Ober.

" **Developer**" <RE*************@a-znet.com> wrote in message
news:uL**************@TK2MSFTNGP10.phx.gbl...

What I mean
is the file there forever or does Window eventually delete it


" **Developer**" <RE*************@a-znet.com> wrote in message
news:OA*************@TK2MSFTNGP10.phx.gbl...
> What is the penalty for not deleting a temp file?
>
> Is that a way to go?
>
>
>
> "Herfried K. Wagner [MVP]" <hi***************@gmx.at> wrote in message
> news:ue**************@TK2MSFTNGP11.phx.gbl...
>>" **Developer**" <RE*************@a-znet.com> schrieb:
>>> When I get the image from the file the file remains locked so the Delete >>> fails with a "used by another process"
>>
>> Check out the code snippets at
>> <URL:http://dotnet.mvps.org/dotnet/code/graphics/#ImageNoLock>.
>>
>> --
>> M S Herfried K. Wagner
>> M V P <URL:http://dotnet.mvps.org/>
>> V B <URL:http://classicvb.org/petition/>
>
>



Jan 19 '06 #16

I solved my problem (7 years ago) by keeping a "dummy.jpg" around that I
assign to the control. Once I started doing this, I was able to delete the
original file.

Mike.

" **Developer**" <RE*************@a-znet.com> wrote in message
news:eN**************@TK2MSFTNGP11.phx.gbl...

Thanks for the two replies.
Did you see Lucky's second post?
Sound reasonable to me.
How does it sound to you?


"Michael D. Ober" <obermd.@.alum.mit.edu.nospam> wrote in message
news:PU*****************@newsread1.news.pas.earthl ink.net...

Based on my experience with the Kodak drivers, you get an error when you
attempt to delete the file. Windows won't delete it later.

Mike Ober.

" **Developer**" <RE*************@a-znet.com> wrote in message
news:uL**************@TK2MSFTNGP10.phx.gbl...

What I mean
is the file there forever or does Window eventually delete it


" **Developer**" <RE*************@a-znet.com> wrote in message
news:OA*************@TK2MSFTNGP10.phx.gbl...
> What is the penalty for not deleting a temp file?
>
> Is that a way to go?
>
>
>
> "Herfried K. Wagner [MVP]" <hi***************@gmx.at> wrote in message > news:ue**************@TK2MSFTNGP11.phx.gbl...
>>" **Developer**" <RE*************@a-znet.com> schrieb:
>>> When I get the image from the file the file remains locked so the

Delete
>>> fails with a "used by another process"
>>
>> Check out the code snippets at
>> <URL:http://dotnet.mvps.org/dotnet/code/graphics/#ImageNoLock>.
>>
>> --
>> M S Herfried K. Wagner
>> M V P <URL:http://dotnet.mvps.org/>
>> V B <URL:http://classicvb.org/petition/>
>
>




Jan 21 '06 #17
Sounds like a good work around.
Based on Lucky's post I looked to see if there file reference was
available - but found nothing.

thanks

"Michael D. Ober" <obermd.@.alum.mit.edu.nospam> wrote in message
news:ET***************@newsread3.news.pas.earthlin k.net...

I solved my problem (7 years ago) by keeping a "dummy.jpg" around that I
assign to the control. Once I started doing this, I was able to delete
the
original file.

Mike.

" **Developer**" <RE*************@a-znet.com> wrote in message
news:eN**************@TK2MSFTNGP11.phx.gbl...

Thanks for the two replies.
Did you see Lucky's second post?
Sound reasonable to me.
How does it sound to you?


"Michael D. Ober" <obermd.@.alum.mit.edu.nospam> wrote in message
news:PU*****************@newsread1.news.pas.earthl ink.net...
>
> Based on my experience with the Kodak drivers, you get an error when
> you
> attempt to delete the file. Windows won't delete it later.
>
> Mike Ober.
>
> " **Developer**" <RE*************@a-znet.com> wrote in message
> news:uL**************@TK2MSFTNGP10.phx.gbl...
>>
>> What I mean
>> is the file there forever or does Window eventually delete it
>>
>>
>>
>>
>> " **Developer**" <RE*************@a-znet.com> wrote in message
>> news:OA*************@TK2MSFTNGP10.phx.gbl...
>> > What is the penalty for not deleting a temp file?
>> >
>> > Is that a way to go?
>> >
>> >
>> >
>> > "Herfried K. Wagner [MVP]" <hi***************@gmx.at> wrote in message >> > news:ue**************@TK2MSFTNGP11.phx.gbl...
>> >>" **Developer**" <RE*************@a-znet.com> schrieb:
>> >>> When I get the image from the file the file remains locked so the
> Delete
>> >>> fails with a "used by another process"
>> >>
>> >> Check out the code snippets at
>> >> <URL:http://dotnet.mvps.org/dotnet/code/graphics/#ImageNoLock>.
>> >>
>> >> --
>> >> M S Herfried K. Wagner
>> >> M V P <URL:http://dotnet.mvps.org/>
>> >> V B <URL:http://classicvb.org/petition/>
>> >
>> >
>>
>>
>>
>
>
>



Jan 21 '06 #18
This works for me... after you close the lcl_fso the file can be
deleted, just don't get rid of the byte_old.

Dim lcl_filename As System.String = "c:\temp\images\test.tif"
Dim lcl_fso As New System.IO.FileStream(lcl_filename, _
IO.FileMode.Open, IO.FileAccess.Read, IO.FileShare.Read)
Dim byte_old() As Byte
Dim tmpint As Integer = Convert.ToInt32(lcl_fso.Length())
With lcl_fso
ReDim byte_old(tmpint)
.Read(byte_old, 0, tmpint)
End With
lcl_fso.Close()
Dim memstream As New System.IO.MemoryStream(byte_old)
Dim lcl_holdimage As System.Drawing.Image = _
System.Drawing.Image.FromStream(memstream)

HTH,
Barry

On Sat, 21 Jan 2006 15:18:37 -0500, " **Developer**"
<RE*************@a-znet.com> wrote:
Sounds like a good work around.
Based on Lucky's post I looked to see if there file reference was
available - but found nothing.

thanks

"Michael D. Ober" <obermd.@.alum.mit.edu.nospam> wrote in message
news:ET***************@newsread3.news.pas.earthli nk.net...

I solved my problem (7 years ago) by keeping a "dummy.jpg" around that I
assign to the control. Once I started doing this, I was able to delete
the
original file.

Mike.

" **Developer**" <RE*************@a-znet.com> wrote in message
news:eN**************@TK2MSFTNGP11.phx.gbl...

Thanks for the two replies.
Did you see Lucky's second post?
Sound reasonable to me.
How does it sound to you?


"Michael D. Ober" <obermd.@.alum.mit.edu.nospam> wrote in message
news:PU*****************@newsread1.news.pas.earthl ink.net...
>
> Based on my experience with the Kodak drivers, you get an error when
> you
> attempt to delete the file. Windows won't delete it later.
>
> Mike Ober.
>
> " **Developer**" <RE*************@a-znet.com> wrote in message
> news:uL**************@TK2MSFTNGP10.phx.gbl...
>>
>> What I mean
>> is the file there forever or does Window eventually delete it
>>
>>
>>
>>
>> " **Developer**" <RE*************@a-znet.com> wrote in message
>> news:OA*************@TK2MSFTNGP10.phx.gbl...
>> > What is the penalty for not deleting a temp file?
>> >
>> > Is that a way to go?
>> >
>> >
>> >
>> > "Herfried K. Wagner [MVP]" <hi***************@gmx.at> wrote in

message
>> > news:ue**************@TK2MSFTNGP11.phx.gbl...
>> >>" **Developer**" <RE*************@a-znet.com> schrieb:
>> >>> When I get the image from the file the file remains locked so the
> Delete
>> >>> fails with a "used by another process"
>> >>
>> >> Check out the code snippets at
>> >> <URL:http://dotnet.mvps.org/dotnet/code/graphics/#ImageNoLock>.
>> >>
>> >> --
>> >> M S Herfried K. Wagner
>> >> M V P <URL:http://dotnet.mvps.org/>
>> >> V B <URL:http://classicvb.org/petition/>
>> >
>> >
>>
>>
>>
>
>
>



bceggersATcomcastDOTnet
Jan 22 '06 #19
Works for me too.
I'll bet I not the only one that will copy your approach.

Thanks
"Barry" <bc******@castcom.com> wrote in message
news:3v********************************@4ax.com...
This works for me... after you close the lcl_fso the file can be
deleted, just don't get rid of the byte_old.

Dim lcl_filename As System.String = "c:\temp\images\test.tif"
Dim lcl_fso As New System.IO.FileStream(lcl_filename, _
IO.FileMode.Open, IO.FileAccess.Read, IO.FileShare.Read)
Dim byte_old() As Byte
Dim tmpint As Integer = Convert.ToInt32(lcl_fso.Length())
With lcl_fso
ReDim byte_old(tmpint)
.Read(byte_old, 0, tmpint)
End With
lcl_fso.Close()
Dim memstream As New System.IO.MemoryStream(byte_old)
Dim lcl_holdimage As System.Drawing.Image = _
System.Drawing.Image.FromStream(memstream)

HTH,
Barry

On Sat, 21 Jan 2006 15:18:37 -0500, " **Developer**"
<RE*************@a-znet.com> wrote:
Sounds like a good work around.
Based on Lucky's post I looked to see if there file reference was
available - but found nothing.

thanks

"Michael D. Ober" <obermd.@.alum.mit.edu.nospam> wrote in message
news:ET***************@newsread3.news.pas.earthl ink.net...

I solved my problem (7 years ago) by keeping a "dummy.jpg" around that I
assign to the control. Once I started doing this, I was able to delete
the
original file.

Mike.

" **Developer**" <RE*************@a-znet.com> wrote in message
news:eN**************@TK2MSFTNGP11.phx.gbl...

Thanks for the two replies.
Did you see Lucky's second post?
Sound reasonable to me.
How does it sound to you?


"Michael D. Ober" <obermd.@.alum.mit.edu.nospam> wrote in message
news:PU*****************@newsread1.news.pas.earthl ink.net...
>
> Based on my experience with the Kodak drivers, you get an error when
> you
> attempt to delete the file. Windows won't delete it later.
>
> Mike Ober.
>
> " **Developer**" <RE*************@a-znet.com> wrote in message
> news:uL**************@TK2MSFTNGP10.phx.gbl...
>>
>> What I mean
>> is the file there forever or does Window eventually delete it
>>
>>
>>
>>
>> " **Developer**" <RE*************@a-znet.com> wrote in message
>> news:OA*************@TK2MSFTNGP10.phx.gbl...
>> > What is the penalty for not deleting a temp file?
>> >
>> > Is that a way to go?
>> >
>> >
>> >
>> > "Herfried K. Wagner [MVP]" <hi***************@gmx.at> wrote in
message
>> > news:ue**************@TK2MSFTNGP11.phx.gbl...
>> >>" **Developer**" <RE*************@a-znet.com> schrieb:
>> >>> When I get the image from the file the file remains locked so
>> >>> the
> Delete
>> >>> fails with a "used by another process"
>> >>
>> >> Check out the code snippets at
>> >> <URL:http://dotnet.mvps.org/dotnet/code/graphics/#ImageNoLock>.
>> >>
>> >> --
>> >> M S Herfried K. Wagner
>> >> M V P <URL:http://dotnet.mvps.org/>
>> >> V B <URL:http://classicvb.org/petition/>
>> >
>> >
>>
>>
>>
>
>
>



bceggersATcomcastDOTnet

Jan 23 '06 #20

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

9
by: Mark | last post by:
I have a working PHP/MySQL application used for data entry. The data entry screen includes a "Save" button. The PHP code for this button looks like this: if (isset($_POST)) { if ($_POST ==...
0
by: troutbum | last post by:
I am experiencing problems when one user has a document open through a share pointing to the web site. I use the dsolefile to read the contents of a particular directory and then display them in a...
2
by: Mark | last post by:
Hello, Say I write a picture file to: 'c:\test.jpg' Then I assign this picture to a picturebox PbFoto.Image = Image.Fromfile("c:\test.jpg") Next I want the overrwrite the file test.jpg with...
4
by: chad.a.morris | last post by:
I'm new to Crystal Reports, so this may be a dumb problem, but I just can't figure it out. Basically, I want to control the selected data in the C# code as opposed to Crystal Reports (since SQL...
3
by: thebhone | last post by:
I am creating a website updater program. Currently working on the image replacement module here. For some reason, after an image (say /images/1.jpg) has been used/opened in the application. I...
6
by: JezB | last post by:
I have an Image object (i) which I want to write to a file. This does work but when I later try to do something with this file I get errors, because I think the file is still 'locked'. I have to...
8
by: MarkAurit | last post by:
I have to display some images kept into a sql server database (image data type) in an asp.net 1.1 page. Is it possible to use an asp control to display the contents of a byte or a MemoryStream?...
2
by: jim-on-linux | last post by:
py help, The file below will run as a stand alone file. It works fine as it is. But, when I call it from another module it locks my computer, The off switch is the only salvation. This...
5
by: buu | last post by:
I have an app made in vb.net with a part of it made in vc.net. after finishing a data processing with a file, I would like to delete that file, but file remains locked to be sure, I was: -...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.