473,322 Members | 1,405 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,322 software developers and data experts.

PictureBox leaving filehandle open

I have a picture (jpg) displaying in a picture box but I find that the
file handle is still open to the image on disk.

I think I need the following to happen

1. Load image from file on disk
2. Copy the loaded image to another object.
3. Close the file on disk
4. Display the image in the picture box as a thumbnail.
5. Allow user to rotate image if necessary by reloading the file
6. Save image back to disk as the same file name

Am I on the right track and if so how do I achieve option 2.

Regards
Jeff
Mar 26 '07 #1
1 2167
Jeff,

You don't need to do all that. How are you loading the image? If
anything, create the FileStream yourself to load into the Bitmap object,
load the file, and then associate it with the picture box. If I recall
correctly, the from file methods (or whatever they are called) open the file
for exclusive access and don't let it go until the picturebox is disposed of
(or rather the Bitmap instance the picturebox conjures up to show the
picture).

Hope this helps.
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com

"Jeff Williams" <je***********@hardsoft.com.auwrote in message
news:13*************@corp.supernews.com...
>I have a picture (jpg) displaying in a picture box but I find that the file
handle is still open to the image on disk.

I think I need the following to happen

1. Load image from file on disk
2. Copy the loaded image to another object.
3. Close the file on disk
4. Display the image in the picture box as a thumbnail.
5. Allow user to rotate image if necessary by reloading the file
6. Save image back to disk as the same file name

Am I on the right track and if so how do I achieve option 2.

Regards
Jeff

Mar 26 '07 #2

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

Similar topics

2
by: Jorge Godoy | last post by:
Hi! I'm trying to get a specific information from inside an image and it works correctly on unices. What I do is: 1. associate a filehandle with the image file 2. get the desired line 3....
1
by: Eduard W. Lohmann | last post by:
Hello. I write this little thing to help me log from several instances of the same class in apache, mod_perl. But I can't figure one thing out. package Logger; require Carp; # Write the...
2
by: Bill | last post by:
I'm trying to use a hash key as a filehandle like so. #!/usr/local/bin/perl use strict; my %buf = ( 'F00' => 'foo.dat' ); &open_files();
2
by: Mattbooty | last post by:
Hello, Not sure if anyone else has seen this bug, but I have a form where the entire form is covered with a picturebox. The picturebox has a mouseup event. I also have an open file dialog for...
4
by: Yash | last post by:
Have used DrawLine() method to draw some lines in the picturebox (sort of a barcode) in the picturebox paint event. This diagram has to be saved as an image in bmp or tiff format. But the problem...
1
by: Zairay | last post by:
Hi All, I'm having a problem with the Shell32.dll when I try to open a program from my Access db. When I try to open a program called FalconViewLite from my access database I get an error in...
0
Robbie
by: Robbie | last post by:
Hi again. I am using MCI to show a video file playing in a picturebox called PicVideo. (This works fine.) SendString = "open " + Chr(34) + DialogStuff.FileName + Chr(34) + " type " + FileType +...
4
by: kimiraikkonen | last post by:
Hi, On my system which is 2.4GHZ P4 CPU, 1GB memory + 64MB DDR graphic card, if i create a simple picturebox docked on a form sized about 500x350 or less or more, doesn't matter, and also if i...
11
by: Rob | last post by:
Hi, I'am using Visual Basic 2005 and ADo.net and a twain-scanner .The purpose of it, is a msaccess-database msaccess with information. about herbes ,plants and birds. I've a lot of pictures...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

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.