Click here to Skip to main content
15,913,027 members
Home / Discussions / C#
   

C#

 
GeneralRe: GDI question ? Pin
Mohammad Dayyan9-Nov-09 2:24
Mohammad Dayyan9-Nov-09 2:24 
GeneralRe: GDI question ? Pin
Luc Pattyn9-Nov-09 2:28
sitebuilderLuc Pattyn9-Nov-09 2:28 
AnswerRe: GDI question ? Pin
Hristo-Bojilov9-Nov-09 3:52
Hristo-Bojilov9-Nov-09 3:52 
QuestionRegarding Crystal report & Windows service? Pin
Tridip Bhattacharjee9-Nov-09 1:47
professionalTridip Bhattacharjee9-Nov-09 1:47 
QuestionReading xlsx file in C# returning blank value Pin
bensonbenadict9-Nov-09 1:13
bensonbenadict9-Nov-09 1:13 
AnswerRe: Reading xlsx file in C# returning blank value Pin
Swetha S14-Jul-10 19:13
Swetha S14-Jul-10 19:13 
Questioni have problem with end of process Pin
E_Gold9-Nov-09 0:14
E_Gold9-Nov-09 0:14 
AnswerRe: i have problem with end of process Pin
Luc Pattyn9-Nov-09 0:27
sitebuilderLuc Pattyn9-Nov-09 0:27 
E_Gold wrote:
i know that the process still work, because when i try to do somthing with the zip file, i get error that the file is in use


That may well be a wrong conclusion. The one way to know whether a process is (still) running or not, is by looking at the Task Manager's list.

Here is what is probably going on:

if you want write or delete access (anything other than read access) to a file that just got created (by yourself or someone else, does not matter), chances are you will find the file is being accessed by some other process, and your access is not granted.

The other process very likely is some server code that is there to assist you somehow. Candidates are:
- anti-virus software (Norton, McAfee, whatever)
- indexing software (Google Desktop, MS Office, whatever)
The common thing is these packages are looking all the time for new files, so they can inspect them.

Microsoft is aware of the consequences; Windows Explorer will try rename and delete attempts up to five times (with one-second interval), and only reports failure if the action continues to fail for that time.

The solution:
1. either use a different file name (not always acceptable)
2. or remove all background reader candidates (bad idea)
3. or implement the retry loop as Explorer has it (use a Windows.Forms.Timer for this)

BTW: if all you need is Read, make sure to allow others to read as well, i.e.
use File.Open(path, FileMode.Open, FileAccess.Read, FileShare.Read)

Remark: in my experience, trying to open/append/close a file more often than once a second succeeds all the time, seems like the inspectors allow for at least one second of inactivity before opening the files themselves.

Smile | :)

Luc Pattyn

I only read code that is properly indented, and rendered in a non-proportional font; hint: use PRE tags in forum messages


QuestionC# with instant messenger Pin
Levisaxos9-Nov-09 0:07
Levisaxos9-Nov-09 0:07 
AnswerRe: C# with instant messenger Pin
Levisaxos9-Nov-09 1:22
Levisaxos9-Nov-09 1:22 
QuestionSpeech Recognition Pin
krinaljariwala8-Nov-09 23:44
krinaljariwala8-Nov-09 23:44 
AnswerMessage Closed Pin
8-Nov-09 23:51
stancrm8-Nov-09 23:51 
GeneralRe: Speech Recognition Pin
krinaljariwala11-Nov-09 19:29
krinaljariwala11-Nov-09 19:29 
QuestionCreate autoplay bots Pin
merger1238-Nov-09 23:34
merger1238-Nov-09 23:34 
AnswerRe: Create autoplay bots Pin
LimitedAtonement9-Nov-09 7:31
LimitedAtonement9-Nov-09 7:31 
QuestionRe: Create autoplay bots Pin
merger1239-Nov-09 21:13
merger1239-Nov-09 21:13 
AnswerRe: Create autoplay bots Pin
LimitedAtonement10-Nov-09 4:19
LimitedAtonement10-Nov-09 4:19 
GeneralRe: Create autoplay bots Pin
merger12310-Nov-09 21:27
merger12310-Nov-09 21:27 
QuestionGetting the cells data when clicked on it in gridview asp.net Pin
sure_suresh8-Nov-09 23:27
sure_suresh8-Nov-09 23:27 
Questionabout treeview, Pin
miss YY8-Nov-09 22:35
miss YY8-Nov-09 22:35 
AnswerRe: about treeview, Pin
Luc Pattyn8-Nov-09 23:16
sitebuilderLuc Pattyn8-Nov-09 23:16 
AnswerRe: about treeview, Pin
Shameel8-Nov-09 23:41
professionalShameel8-Nov-09 23:41 
GeneralRe: about treeview, Pin
miss YY9-Nov-09 0:13
miss YY9-Nov-09 0:13 
QuestionWeird problem in C#.NET [Solved ^_^] Pin
Bilg218-Nov-09 22:35
Bilg218-Nov-09 22:35 
AnswerRe: Weird problem in C#.NET Pin
Jorg DD8-Nov-09 23:43
Jorg DD8-Nov-09 23:43 

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.