Click here to Skip to main content
15,924,193 members
Home / Discussions / C#
   

C#

 
GeneralRe: Need urgent help Pin
ass3aad15-May-06 6:46
ass3aad15-May-06 6:46 
GeneralRe: Need urgent help Pin
Judah Gabriel Himango15-May-06 8:24
sponsorJudah Gabriel Himango15-May-06 8:24 
GeneralRe: Need urgent help Pin
Dave Kreskowiak15-May-06 14:30
mveDave Kreskowiak15-May-06 14:30 
QuestionFile.Delete() fails (Access rights required???) Pin
Shy Agam15-May-06 5:16
Shy Agam15-May-06 5:16 
AnswerRe: File.Delete() fails (Access rights required???) Pin
leppie15-May-06 5:27
leppie15-May-06 5:27 
GeneralRe: File.Delete() fails (Access rights required???) Pin
Shy Agam15-May-06 6:15
Shy Agam15-May-06 6:15 
AnswerRe: File.Delete() fails (Access rights required???) Pin
Judah Gabriel Himango15-May-06 6:25
sponsorJudah Gabriel Himango15-May-06 6:25 
GeneralRe: File.Delete() fails (Access rights required???) Pin
Shy Agam15-May-06 7:25
Shy Agam15-May-06 7:25 
Judah Himango wrote:
Otherwise, if you're using multiple threads, perhaps another thread is calling this same method or accessing the file somewhere else?


Indeed, I am using multiple threads.
Though the method IS accessed by multiple threads at the same time, every thread has its own fileName...
Thus, there is no chance (I hope I'm not wrong Poke tongue | ;-P ) that one thread is accessing another's file.

Taking this a bit further, I've got an array of sockets.
All sockets call this method.
The files I'm sending are jpg files...
I have a class with a Bitmap field, and an array of objects of this class.

On "Analyze the new file" part, I have a call to a method located inside this class, which loads the file into the Bitmap object.
I obtain the index of the socket received the data, and use it as the index in the other array, to load the jpg file into the appropriate object.
public void FromFile(string fileName)
{
    /* bmp is a private field of my class */
    bmp.FromFile(fileName);
}

Before posting my original message, I've guessed this might be the problem.
So I've attempted the following:
public void FromFile(string fileName)
{
    Bitmap tmp = (Bitmap)Bitmap.FromFile(fileName);
    bmp = tmp.Clone();
    tmp.Dispose();
    tmp = null;
    GC.Collect();
}

Didn't work either...
Is it possible that loading the jpg file into the Bitmap object causes a lock of the file?

-- modified at 13:30 Monday 15th May, 2006
AnswerRe: File.Delete() fails (Access rights required???) Pin
Guffa15-May-06 7:57
Guffa15-May-06 7:57 
GeneralRe: File.Delete() fails (Access rights required???) Pin
Shy Agam15-May-06 8:38
Shy Agam15-May-06 8:38 
GeneralRe: File.Delete() fails (Access rights required???) Pin
Dan Neely15-May-06 8:52
Dan Neely15-May-06 8:52 
GeneralRe: File.Delete() fails (Access rights required???) Pin
Shy Agam16-May-06 7:41
Shy Agam16-May-06 7:41 
GeneralRe: File.Delete() fails (Access rights required???) Pin
Judah Gabriel Himango15-May-06 8:13
sponsorJudah Gabriel Himango15-May-06 8:13 
GeneralRe: File.Delete() fails (Access rights required???) Pin
Shy Agam15-May-06 8:31
Shy Agam15-May-06 8:31 
GeneralRe: File.Delete() fails (Access rights required???) Pin
Judah Gabriel Himango15-May-06 10:10
sponsorJudah Gabriel Himango15-May-06 10:10 
AnswerRe: File.Delete() fails (Access rights required???) Pin
Shy Agam15-May-06 8:48
Shy Agam15-May-06 8:48 
QuestionContextMenu + NotifyIcon + LEFT Click Problem Pin
Phoen2515-May-06 4:59
Phoen2515-May-06 4:59 
AnswerRe: ContextMenu + NotifyIcon + LEFT Click Problem Pin
NaNg1524115-May-06 6:46
NaNg1524115-May-06 6:46 
GeneralRe: ContextMenu + NotifyIcon + LEFT Click Problem Pin
Phoen2515-May-06 7:48
Phoen2515-May-06 7:48 
GeneralRe: ContextMenu + NotifyIcon + LEFT Click Problem Pin
Nader Elshehabi15-May-06 12:56
Nader Elshehabi15-May-06 12:56 
GeneralRe: ContextMenu + NotifyIcon + LEFT Click Problem Pin
Phoen2516-May-06 4:03
Phoen2516-May-06 4:03 
GeneralRe: ContextMenu + NotifyIcon + LEFT Click Problem Pin
Nader Elshehabi16-May-06 11:15
Nader Elshehabi16-May-06 11:15 
GeneralRe: ContextMenu + NotifyIcon + LEFT Click Problem Pin
Phoen2517-May-06 5:05
Phoen2517-May-06 5:05 
GeneralRe: ContextMenu + NotifyIcon + LEFT Click Problem Pin
Nader Elshehabi17-May-06 6:23
Nader Elshehabi17-May-06 6:23 
GeneralRe: ContextMenu + NotifyIcon + LEFT Click Problem Pin
Phoen2518-May-06 2:30
Phoen2518-May-06 2:30 

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.