?
Solved

Load image, then unload it so I can delete it...

Posted on 2004-09-19
5
Medium Priority
?
239 Views
Last Modified: 2012-08-14
Hello

I want to load an image into an picturebox and after that I want to unload it so I can delete the image-file (cannot delete it while it is in the picturebox)

I tried to put picturebox.image = nothing but I still could not delete it...

Is there an other possibility to do that?

thanks

Sven
0
Comment
Question by:Svenrutten
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
5 Comments
 
LVL 1

Accepted Solution

by:
hagipmc earned 140 total points
ID: 12096283
Hi!

Sol 1:
  Create an ImageList control and add your images to the collection. This way your images are included in your resources files, so you can delete them anytime you want it. To get a pic from the imagelist control to a picturebox control you can use this code:

       ' Me.picBox.SizeMode = PictureBoxSizeMode.StretchImage
       Me.picBox.Image = Me.ImageList1.Images.Item(0)

The only problem is that in an imagelist control can store images no larger than 256x256, so this solution in no good for large images because they are resized to a max 256x256 format.


Sol2:
 Create a temporary image object , use it and then dispose it:

        Dim imgObj As Image
        imgObj = System.Drawing.Image.FromFile("C:\Images\Winter.jpg")
        Me.picBox.Image = New Bitmap(imgObj)
        imgObj.Dispose()

This is much better :)

Good luck!
0
 

Expert Comment

by:peichen
ID: 12114521

This should do it.  Change the "LocalPath" your image path and "Picture.jpg" as the Picture name


***********************************************************

<%@ Import Namespace="System.Web.UI.HtmlControls.HtmlInputFile" %>

File.Delete("C:\LocalPath\Picture.jpg")

***********************************************************
0

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I think the Typed DataTable and Typed DataSet are very good options when working with data, but I don't like auto-generated code. First, I create an Abstract Class for my DataTables Common Code.  This class Inherits from DataTable. Also, it can …
If you're writing a .NET application to connect to an Access .mdb database and use pre-existing queries that require parameters, you've come to the right place! Let's say the pre-existing query(qryCust) in Access takes a Date as a parameter and l…
Michael from AdRem Software explains how to view the most utilized and worst performing nodes in your network, by accessing the Top Charts view in NetCrunch network monitor (https://www.adremsoft.com/). Top Charts is a view in which you can set seve…
Do you want to know how to make a graph with Microsoft Access? First, create a query with the data for the chart. Then make a blank form and add a chart control. This video also shows how to change what data is displayed on the graph as well as form…
Suggested Courses
Course of the Month15 days, 6 hours left to enroll

770 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question