Click here to Skip to main content
15,921,646 members
Home / Discussions / C#
   

C#

 
GeneralRe: Date Conversion Pin
mrarunks2-Mar-07 2:53
mrarunks2-Mar-07 2:53 
GeneralRe: Date Conversion Pin
mrarunks2-Mar-07 3:32
mrarunks2-Mar-07 3:32 
GeneralRe: Date Conversion Pin
Scott Dorman2-Mar-07 4:20
professionalScott Dorman2-Mar-07 4:20 
QuestionHELP :( Pin
İsmail Durmaz28-Feb-07 10:36
İsmail Durmaz28-Feb-07 10:36 
Questioncircle shapes Pin
md_refay28-Feb-07 10:29
md_refay28-Feb-07 10:29 
AnswerRe: circle shapes Pin
Christian Graus28-Feb-07 10:39
protectorChristian Graus28-Feb-07 10:39 
QuestionWindows Service in C#.Net 2.0, moving files from directory Pin
adnanrafiq28-Feb-07 10:05
adnanrafiq28-Feb-07 10:05 
AnswerRe: Windows Service in C#.Net 2.0, moving files from directory Pin
gus_br28-Feb-07 18:36
gus_br28-Feb-07 18:36 
Hi Adnan,

Are you using a FileSystemWatcher to monitor the upload directory?
If so, you have to make a do/while loop and try do access the file in a try/catch block inside the do/while loop. If you can access the file (it doesn't throw an exception of being current in use) you set a flag in order to exit from the loop. I think it should look something like this:


<br />
bool uploadCompleted = false;<br />
do<br />
{<br />
     try<br />
     {<br />
          File.Open("yourFileName", FileMode.Open, FileAccess.Read).Close();<br />
          uploadCompleted = true;<br />
     }<br />
     catch<br />
     {<br />
     }<br />
}<br />
while (uploadCompleted != true)<br />


I done it before and it worked. I couldn't find another approach so solve it (even made some posts in CP to find an answer). The problem is that the event is fired up even when the copy/move/creation is not complete, so you can't access the file yet. :/
Someone developed a customized code do solve this and wrote an article about this wrapper here in CP, but I thought it was too complicated and done the almost same thing I'm saying after all.

Hope it helps you...
CYA
GeneralRe: Windows Service in C#.Net 2.0, moving files from directory Pin
adnanrafiq28-Feb-07 18:54
adnanrafiq28-Feb-07 18:54 
GeneralRe: Windows Service in C#.Net 2.0, moving files from directory Pin
gus_br1-Mar-07 1:17
gus_br1-Mar-07 1:17 
QuestionHow to diplay web page inside another web page window? Pin
cebyrjoe228-Feb-07 9:27
cebyrjoe228-Feb-07 9:27 
AnswerRe: How to diplay web page inside another web page window? Pin
Wayne Phipps28-Feb-07 9:46
Wayne Phipps28-Feb-07 9:46 
AnswerRe: How to diplay web page inside another web page window? Pin
Vasudevan Deepak Kumar28-Feb-07 14:38
Vasudevan Deepak Kumar28-Feb-07 14:38 
QuestionHow to retrieve non fixed-length records from a binary file Pin
htres28-Feb-07 9:20
htres28-Feb-07 9:20 
AnswerRe: How to retrieve non fixed-length records from a binary file Pin
Luc Pattyn28-Feb-07 10:14
sitebuilderLuc Pattyn28-Feb-07 10:14 
GeneralRe: How to retrieve non fixed-length records from a binary file Pin
htres1-Mar-07 3:04
htres1-Mar-07 3:04 
GeneralRe: How to retrieve non fixed-length records from a binary file Pin
Luc Pattyn1-Mar-07 7:07
sitebuilderLuc Pattyn1-Mar-07 7:07 
AnswerRe: How to retrieve non fixed-length records from a binary file Pin
htres5-Mar-07 4:48
htres5-Mar-07 4:48 
GeneralRe: How to retrieve non fixed-length records from a binary file Pin
Luc Pattyn5-Mar-07 11:14
sitebuilderLuc Pattyn5-Mar-07 11:14 
GeneralRe: How to retrieve non fixed-length records from a binary file Pin
htres5-Mar-07 13:11
htres5-Mar-07 13:11 
AnswerRe: How to retrieve non fixed-length records from a binary file Pin
DavidAtAscent28-Feb-07 14:12
DavidAtAscent28-Feb-07 14:12 
QuestionHow to add new control instances with sprcified name from within a custom control at design time Pin
Galib Anwar28-Feb-07 9:08
Galib Anwar28-Feb-07 9:08 
QuestionRegistering a COM component to use in VB6 Pin
gus_br28-Feb-07 8:31
gus_br28-Feb-07 8:31 
AnswerRe: Registering a COM component to use in VB6 Pin
mike montagne28-Feb-07 8:43
mike montagne28-Feb-07 8:43 
AnswerRe: Registering a COM component to use in VB6 Pin
DavidAtAscent28-Feb-07 13:49
DavidAtAscent28-Feb-07 13:49 

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.