473,795 Members | 3,331 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

can't delete file

I need a form to delete an image that is shown in a control, to replace with
another image.
I tried changing the archive that is showing the control, closing the form
and then deleting the old image, but there's an error
because the system says that the archive is in use.
I need to replace this image, someone knows a way to close conections to the
archive, or something like this?
Thanks

Nov 21 '05 #1
2 1467
"Penk" <el*****@hotmai l.com> schrieb:
I need a form to delete an image that is shown in a control, to replace
with
another image.
I tried changing the archive that is showing the control, closing the form
and then deleting the old image, but there's an error
because the system says that the archive is in use.
I need to replace this image, someone knows a way to close conections to
the
archive, or something like this?


\\\
Dim OriginalImage As New Bitmap("C:\WIND OWS\Angler.bmp" )
Dim Image As New Bitmap(Original Image)
OriginalImage.D ispose()
..
..
..
Image.Dispose()
///

- or -

\\\
Dim ImageFile As New FileStream("C:\ WINDOWS\Angler. bmp", FileMode.Open)
Dim Reader As New BinaryReader(Im ageFile)
Dim ImageStream As New
MemoryStream(Re ader.ReadBytes( CInt(ImageFile. Length)))
Reader.Close()
Dim Image As Image = Image.FromStrea m(ImageStream)
..
..
..
Image.Dispose()
///

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

Nov 21 '05 #2
"Penk" <el*****@hotmai l.com> schrieb:
I need a form to delete an image that is shown in a control, to replace
with
another image.
I tried changing the archive that is showing the control, closing the form
and then deleting the old image, but there's an error
because the system says that the archive is in use.
I need to replace this image, someone knows a way to close conections to
the
archive, or something like this?


\\\
Dim OriginalImage As New Bitmap("C:\WIND OWS\Angler.bmp" )
Dim Image As New Bitmap(Original Image)
OriginalImage.D ispose()
..
..
..
Image.Dispose()
///

- or -

\\\
Dim ImageFile As New FileStream("C:\ WINDOWS\Angler. bmp", FileMode.Open)
Dim Reader As New BinaryReader(Im ageFile)
Dim ImageStream As New
MemoryStream(Re ader.ReadBytes( CInt(ImageFile. Length)))
Reader.Close()
Dim Image As Image = Image.FromStrea m(ImageStream)
..
..
..
Image.Dispose()
///

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

Nov 21 '05 #3

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

Similar topics

3
3208
by: lawrence | last post by:
I've two scripts, one to upload images, another to delete them. The upload script works fine, but the delete script has permissions trouble. How can PHP not have permission to delete an image it itself uploaded? Here is the delete script I'm using right now, and the error messages I got below.
18
9118
by: Dino | last post by:
dear all, i've created an application for a customer where the customer can upload ..csv-files into a specified ftp-directory. on the server, a php-script, triggered by a cronjob, reads all the data, imports it into a mySQL database and deletes the .csv-file after the import. so far, so good. but in some cases the cronjobs starts running when the file is not completely
0
1660
by: Phil... | last post by:
I have a directory with a lot of jpg files. I want to delete the small ones. Small means less than 100 pixels by 100 pixels. I use File.list() to get the list of files. I use ImageIcon(filename) to create an ImageIcon. I use getIconHeight() and getIconWidth(). then I try to delete the file if it meets the "small" test. I tried to use File.delete(), but most of the time this returns "false" and the file is not deleted. If I use...
0
2104
by: SeanR | last post by:
I have a function to copare two files. It will first copy the original file form a different server to a local temp path and then compare that version to a version that has been restored form tape. Once the compare is complete the file that was copied to a temp location needs to be deleted. I am using the method file.copy(sourcePath, tempPath, true) to copy the file and then file.delete(tempPath) to delete the file. On some of the files...
5
5248
by: | last post by:
Hi all, I've been using C++ for quite a while now and I've come to the point where I need to overload new and delete inorder to track memory and probably some profiling stuff too. I know that discussions of new and delete is a pretty damn involved process but I'll try to stick to the main information I'm looking for currently. I've searched around for about the last too weeks and have read up on new and overloading it to some extent but...
12
8019
by: Lucas Tam | last post by:
I have a very simple loop: If (Directory.Exists(tempDirectory)) Then Try Dim Files() As String = Directory.GetFiles(tempDirectory) 'Clear out directory For Each Filename As String In Files File.Delete(Filename) Next Catch ex As Exception
9
8337
by: Paul | last post by:
I'm trying to make get my app to delete all the files in a specified folder and all the files within the folders of the specified folder. e.g. Folder 1 contains three files (File1, File2, File3) and two folders (Subfolder 1, Subfolder 2). .......I need to delete File1, File2, File3. Subfolder 1 contains FileA. .......Need to delete FileA. Subfolder 2 contains FileB, FileC, FileD.
2
4750
by: createdbyx | last post by:
I am trying to make a file sync utillity to sync files between my laptop and my desktop pc. On my desktop machine (xp pro sp2) I have shared my "Visual Studio Projects" folder using windows simple file sharing. And have specified the "Allow network users to change my files." option as well. Then on my laptop (xp home sp2) I have mapped a network drive using windows explorer. So on my laptop I have a Y: drive that points to the "Visual...
2
2759
by: dasilva109 | last post by:
Hi guys I am new to C++ and need urgent help with this part of my code for a uni coursework I have to submit by Thursday //ClientData.h #ifndef CLIENTDATA_H #define CLIENTDATA_H #include <string>
13
2395
by: darrel | last post by:
When I write scripts for deleting records in databases, I tend to do it in this fashion: - delete link passes ID to a delete.aspx page - delete.aspx page queries db using that ID to retrieve the file information - page displays file information with a 'are you sure you want to delete' confirmation button. - upon clicking said button, I delete the record.
0
9672
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10435
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
10163
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
1
7538
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6779
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5436
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5563
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4113
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3721
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.