Click here to Skip to main content
15,895,283 members
Home / Discussions / C#
   

C#

 
AnswerRe: Using sortedlist or sorteddictionary Pin
dan!sh 28-May-09 7:30
professional dan!sh 28-May-09 7:30 
GeneralRe: Using sortedlist or sorteddictionary Pin
michaelgr128-May-09 7:42
michaelgr128-May-09 7:42 
GeneralRe: Using sortedlist or sorteddictionary Pin
michaelgr128-May-09 8:21
michaelgr128-May-09 8:21 
GeneralRe: Using sortedlist or sorteddictionary Pin
Henry Minute28-May-09 8:26
Henry Minute28-May-09 8:26 
GeneralRe: Using sortedlist or sorteddictionary Pin
michaelgr128-May-09 8:34
michaelgr128-May-09 8:34 
QuestionFile System C# Pin
sonya_rbi28-May-09 7:08
sonya_rbi28-May-09 7:08 
AnswerRe: File System C# Pin
DaveyM6928-May-09 7:28
professionalDaveyM6928-May-09 7:28 
AnswerRe: File System C# Pin
Luc Pattyn28-May-09 7:51
sitebuilderLuc Pattyn28-May-09 7:51 
Hi,



sonya_rbi wrote:
I have even closed tw


You're too kind. Of course, if you create or open something, you have to close it too.

My bet is you are victim to the goodness of Windows or one of the utilities you added. Here is a standard text snippet explaining the risk you are under:

---------------
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
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)

---------------
In my experience, this happens when the succesive open/write/close cycles are more than 1 second apart; if you do it more frequently, you won't have any trouble (I log stuff with open/write/close all the time).

Smile | :)

Luc Pattyn [Forum Guidelines] [My Articles]

The quality and detail of your question reflects on the effectiveness of the help you are likely to get.
Show formatted code inside PRE tags, and give clear symptoms when describing a problem.

QuestionAn elegant binding solution to getting the user to choose a COM port Pin
edwaugh28-May-09 7:02
edwaugh28-May-09 7:02 
AnswerRe: An elegant binding solution to getting the user to choose a COM port Pin
Ennis Ray Lynch, Jr.28-May-09 7:27
Ennis Ray Lynch, Jr.28-May-09 7:27 
AnswerRe: An elegant binding solution to getting the user to choose a COM port Pin
edwaugh28-May-09 9:30
edwaugh28-May-09 9:30 
QuestionA read only CheckBox in WPF Pin
edwaugh28-May-09 6:46
edwaugh28-May-09 6:46 
Questioncreating a calendar Pin
benjamin yap28-May-09 6:23
benjamin yap28-May-09 6:23 
AnswerRe: creating a calendar Pin
dan!sh 28-May-09 6:35
professional dan!sh 28-May-09 6:35 
GeneralRe: creating a calendar Pin
benjamin yap28-May-09 6:40
benjamin yap28-May-09 6:40 
GeneralRe: creating a calendar Pin
dan!sh 28-May-09 7:02
professional dan!sh 28-May-09 7:02 
AnswerRe: creating a calendar Pin
led mike28-May-09 7:02
led mike28-May-09 7:02 
QuestionFull text Search Pin
ellllllllie28-May-09 6:10
ellllllllie28-May-09 6:10 
AnswerRe: Full text Search Pin
EliottA28-May-09 8:45
EliottA28-May-09 8:45 
QuestionNumber of DataGridViewRow's that have Visible == true Pin
Dan Neely28-May-09 5:55
Dan Neely28-May-09 5:55 
AnswerRe: Number of DataGridViewRow's that have Visible == true Pin
dan!sh 28-May-09 6:25
professional dan!sh 28-May-09 6:25 
GeneralRe: Number of DataGridViewRow's that have Visible == true Pin
Dan Neely28-May-09 7:05
Dan Neely28-May-09 7:05 
GeneralRe: Number of DataGridViewRow's that have Visible == true Pin
dan!sh 28-May-09 7:17
professional dan!sh 28-May-09 7:17 
GeneralRe: Number of DataGridViewRow's that have Visible == true Pin
Dan Neely28-May-09 7:25
Dan Neely28-May-09 7:25 
QuestionSending the button name to a method. Pin
outerhell28-May-09 4:52
outerhell28-May-09 4:52 

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.