Click here to Skip to main content
16,005,080 members
Home / Discussions / C#
   

C#

 
QuestionPrimary key Ascending Pin
ytubis27-Feb-06 8:12
ytubis27-Feb-06 8:12 
AnswerRe: Primary key Ascending Pin
Steve Maier27-Feb-06 8:41
professionalSteve Maier27-Feb-06 8:41 
QuestionHow to delete a picture??? Pin
CrazyDragon638427-Feb-06 7:53
CrazyDragon638427-Feb-06 7:53 
AnswerRe: How to delete a picture??? Pin
mav.northwind27-Feb-06 8:04
mav.northwind27-Feb-06 8:04 
GeneralRe: How to delete a picture??? Pin
CrazyDragon638427-Feb-06 15:12
CrazyDragon638427-Feb-06 15:12 
GeneralRe: How to delete a picture??? Pin
mav.northwind27-Feb-06 20:08
mav.northwind27-Feb-06 20:08 
GeneralRe: How to delete a picture??? Pin
CrazyDragon638428-Feb-06 15:25
CrazyDragon638428-Feb-06 15:25 
GeneralRe: How to delete a picture??? Pin
mav.northwind28-Feb-06 21:28
mav.northwind28-Feb-06 21:28 
Ok, now that we know what your problem is, we can help you... Smile | :)
You have to make sure the image file isn't being used any more.
The most probable cause is that the image that has been assigned to the PictureBox hasn't been disposed of yet.

First, you'll have to make sure you don't let any old references hanging around when you load an image into your PictureBox. For example, when setting an image to display you could write
if (pictureBox1.Image != null)
{
  pictureBox1.Image.Dispose();
  pictureBox1.Image = null;
}
pictureBox1.Image = newImageToShow;
That way, only the image currently shown in the PictureBox is used.
Before you can delete the file, you'll also have to remove any references, for example:
private void buttonDelete_Pressed(object sender, EventArgs e)
{
  pictureBox1.Image.Dispose();
  pictureBox1.Image = null;
  File.Delete(pathToCurrentImage);
}


Regards,
mav

--
Black holes are the places where god divided by 0...
GeneralRe: How to delete a picture??? Pin
CrazyDragon63841-Mar-06 7:22
CrazyDragon63841-Mar-06 7:22 
GeneralRe: How to delete a picture??? Pin
mav.northwind1-Mar-06 7:48
mav.northwind1-Mar-06 7:48 
GeneralRe: How to delete a picture??? Pin
CrazyDragon63842-Mar-06 3:21
CrazyDragon63842-Mar-06 3:21 
QuestionForcing MSIL code to Native code? Pin
pankazmittal27-Feb-06 7:33
pankazmittal27-Feb-06 7:33 
AnswerRe: Forcing MSIL code to Native code? Pin
mav.northwind27-Feb-06 8:02
mav.northwind27-Feb-06 8:02 
AnswerRe: Forcing MSIL code to Native code? Pin
leppie27-Feb-06 8:06
leppie27-Feb-06 8:06 
AnswerRe: Forcing MSIL code to Native code? Pin
pankazmittal27-Feb-06 8:51
pankazmittal27-Feb-06 8:51 
QuestionConsole App Pin
niceguyeddie199927-Feb-06 6:54
niceguyeddie199927-Feb-06 6:54 
AnswerRe: Console App Pin
RobertChan200027-Feb-06 7:21
RobertChan200027-Feb-06 7:21 
AnswerRe: Console App Pin
Sean8927-Feb-06 8:57
Sean8927-Feb-06 8:57 
Questionhow to create multiple timers Pin
batmanAgen27-Feb-06 6:37
batmanAgen27-Feb-06 6:37 
AnswerRe: how to create multiple timers Pin
CWIZO27-Feb-06 10:43
CWIZO27-Feb-06 10:43 
QuestionContextMenu problem in Compact Framework? Pin
pmasknguyen27-Feb-06 6:02
pmasknguyen27-Feb-06 6:02 
AnswerRe: ContextMenu problem in Compact Framework? Pin
microsoc27-Feb-06 14:20
microsoc27-Feb-06 14:20 
GeneralRe: ContextMenu problem in Compact Framework? Pin
pmasknguyen27-Feb-06 14:55
pmasknguyen27-Feb-06 14:55 
GeneralRe: ContextMenu problem in Compact Framework? Pin
microsoc27-Feb-06 16:25
microsoc27-Feb-06 16:25 
QuestionDatagridview currentrowindex Pin
stijnbe27-Feb-06 4:13
stijnbe27-Feb-06 4:13 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.