Click here to Skip to main content
15,915,603 members
Home / Discussions / C#
   

C#

 
Questioncreat a xml with data appending on the other Pin
dhol5-Jan-06 1:46
dhol5-Jan-06 1:46 
Questionhow to submit a form based on a condition in C# Pin
Suman Singh5-Jan-06 1:45
professionalSuman Singh5-Jan-06 1:45 
AnswerRe: how to submit a form based on a condition in C# Pin
Guffa5-Jan-06 2:15
Guffa5-Jan-06 2:15 
GeneralRe: how to submit a form based on a condition in C# Pin
Suman Singh5-Jan-06 2:24
professionalSuman Singh5-Jan-06 2:24 
AnswerRe: how to submit a form based on a condition in C# Pin
Guffa5-Jan-06 3:34
Guffa5-Jan-06 3:34 
QuestionCoding on the Vector Graphics Pin
richarding5-Jan-06 1:38
richarding5-Jan-06 1:38 
AnswerRe: Coding on the Vector Graphics Pin
mav.northwind5-Jan-06 3:15
mav.northwind5-Jan-06 3:15 
QuestionDoes File.Copy() prevent other file commands? Pin
Sensei765-Jan-06 1:24
Sensei765-Jan-06 1:24 
Hello, I wonder where this often appearing error comes from. I'd guess nearly every programmer knows the "...is being used by another process" problem.

My situation:
In my application I need to perform a couple of tasks on a single file like:
- writing some bytes into it
- copy it (I cannot use File.Move() at his point)
- and shortly after that: rename the copy with File.Move()

When executing next command after File.Copy() that also accesses the file (no matter if that is Move(), another Copy() command, or whatever) I get the classic exception with the errormessage "Cannot access file XYZ because it is being used by another process."

If I simply catch the exception - and do nothing within the catch block - the file operations all work SUCCESSFULLY.

So my question is, what is going on there?
Is it a possibly explanation that the execution of the application already continues although File.Copy() has not finished, and so the next file operation command accesses too early?

Is there a more elegant way to solve this other than an empty try...catch block?
I am sure there is... but what?

I'm curious about your opinions.
AnswerRe: Does File.Copy() prevent other file commands? Pin
S. Senthil Kumar5-Jan-06 3:19
S. Senthil Kumar5-Jan-06 3:19 
AnswerRe: Does File.Copy() prevent other file commands? Pin
mav.northwind5-Jan-06 3:19
mav.northwind5-Jan-06 3:19 
GeneralRe: Does File.Copy() prevent other file commands? Pin
Sensei765-Jan-06 5:30
Sensei765-Jan-06 5:30 
QuestionHow to put data from an IList to a Dataset Pin
LongNguyen5-Jan-06 0:34
LongNguyen5-Jan-06 0:34 
AnswerRe: How to put data from an IList to a Dataset Pin
VenkataRamana.Gali5-Jan-06 0:45
VenkataRamana.Gali5-Jan-06 0:45 
QuestionRe: How to put data from an IList to a Dataset Pin
LongNguyen5-Jan-06 0:49
LongNguyen5-Jan-06 0:49 
AnswerRe: How to put data from an IList to a Dataset Pin
VenkataRamana.Gali5-Jan-06 0:57
VenkataRamana.Gali5-Jan-06 0:57 
QuestionRe: How to put data from an IList to a Dataset Pin
LongNguyen5-Jan-06 14:57
LongNguyen5-Jan-06 14:57 
QuestionProblem after creating an installer for my project Pin
ger_creal4-Jan-06 23:57
ger_creal4-Jan-06 23:57 
AnswerRe: Problem after creating an installer for my project Pin
Curtis Schlak.5-Jan-06 8:23
Curtis Schlak.5-Jan-06 8:23 
QuestionCreate a new Event in C# Webform! Pin
LordBalu4-Jan-06 23:30
LordBalu4-Jan-06 23:30 
AnswerRe: Create a new Event in C# Webform! Pin
VenkataRamana.Gali5-Jan-06 0:20
VenkataRamana.Gali5-Jan-06 0:20 
AnswerRe: Create a new Event in C# Webform! Pin
LordBalu5-Jan-06 0:51
LordBalu5-Jan-06 0:51 
QuestionUsing radio button / check boxes in touch screen Pin
madhusri4-Jan-06 23:19
madhusri4-Jan-06 23:19 
AnswerRe: Using radio button / check boxes in touch screen Pin
Curtis Schlak.5-Jan-06 8:26
Curtis Schlak.5-Jan-06 8:26 
QuestionIs there any facility in VS 2005 to do unit testing Pin
engsrini4-Jan-06 22:36
engsrini4-Jan-06 22:36 
AnswerRe: Is there any facility in VS 2005 to do unit testing Pin
Vikram A Punathambekar5-Jan-06 0:17
Vikram A Punathambekar5-Jan-06 0:17 

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.