Click here to Skip to main content
15,923,168 members
Home / Discussions / C#
   

C#

 
GeneralRe: Ajaxupload Pin
Keith Barrow21-Apr-11 7:10
professionalKeith Barrow21-Apr-11 7:10 
AnswerRe: Ajaxupload Pin
BobJanova21-Apr-11 0:26
BobJanova21-Apr-11 0:26 
GeneralRe: Ajaxupload Pin
dbongs21-Apr-11 0:32
dbongs21-Apr-11 0:32 
Questiontry {} catch {} not working Pin
ShadowUz20-Apr-11 22:59
ShadowUz20-Apr-11 22:59 
AnswerRe: try {} catch {} not working Pin
BobJanova20-Apr-11 23:17
BobJanova20-Apr-11 23:17 
AnswerRe: try {} catch {} not working [modified] Pin
ShadowUz20-Apr-11 23:32
ShadowUz20-Apr-11 23:32 
GeneralRe: try {} catch {} not working Pin
BobJanova21-Apr-11 0:25
BobJanova21-Apr-11 0:25 
AnswerRe: try {} catch {} not working Pin
Wayne Gaylard20-Apr-11 23:27
professionalWayne Gaylard20-Apr-11 23:27 
I use this function,

C#
private static bool FileInUse(string path)
       {
           FileInfo file = new FileInfo(path);
           FileStream stream = null;
           try
           {
               stream = file.Open(FileMode.Open, FileAccess.ReadWrite, FileShare.None);
           }
           catch (IOException ex)
           {
               //MessageBox.Show(ex.Message);
               //File in use
               return true;
           }
           finally
           {
               if (stream != null)
                   stream.Close();
           }
           return false;
       }


although it will only return true if the file is Locked by another application(or yours). If the other application has opened the file without locking it will return false. You should be careful with your implementation as if the file is not found it would create one.
...and I have extensive experience writing computer code, including OIC, BTW, BRB, IMHO, LMAO, ROFL, TTYL.....

GeneralRe: try {} catch {} not working Pin
ShadowUz20-Apr-11 23:38
ShadowUz20-Apr-11 23:38 
AnswerRe: try {} catch {} not working Pin
Ennis Ray Lynch, Jr.21-Apr-11 3:34
Ennis Ray Lynch, Jr.21-Apr-11 3:34 
QuestionWindows Application Pin
dbongs20-Apr-11 21:42
dbongs20-Apr-11 21:42 
AnswerRe: Windows Application Pin
Wayne Gaylard20-Apr-11 22:09
professionalWayne Gaylard20-Apr-11 22:09 
JokeRe: Windows Application Pin
Mycroft Holmes20-Apr-11 22:15
professionalMycroft Holmes20-Apr-11 22:15 
GeneralRe: Windows Application Pin
dbongs20-Apr-11 23:40
dbongs20-Apr-11 23:40 
GeneralRe: Windows Application Pin
Pete O'Hanlon21-Apr-11 9:57
mvePete O'Hanlon21-Apr-11 9:57 
AnswerRe: Windows Application Pin
wizardzz21-Apr-11 6:27
wizardzz21-Apr-11 6:27 
QuestionHow to add application name in context menu. Pin
sarang_k20-Apr-11 21:00
sarang_k20-Apr-11 21:00 
AnswerRe: How to add application name in context menu. Pin
Mycroft Holmes20-Apr-11 22:20
professionalMycroft Holmes20-Apr-11 22:20 
GeneralRe: How to add application name in context menu. Pin
BobJanova20-Apr-11 23:18
BobJanova20-Apr-11 23:18 
AnswerRe: How to add application name in context menu. Pin
BobJanova20-Apr-11 23:28
BobJanova20-Apr-11 23:28 
Questionhow to deploy the C# application on the linux platform Pin
scoket20-Apr-11 18:19
scoket20-Apr-11 18:19 
AnswerRe: how to deploy the C# application on the linux platform Pin
GlobX20-Apr-11 19:56
GlobX20-Apr-11 19:56 
AnswerRe: how to deploy the C# application on the linux platform Pin
John-ph20-Apr-11 20:35
John-ph20-Apr-11 20:35 
GeneralRe: how to deploy the C# application on the linux platform Pin
scoket20-Apr-11 20:38
scoket20-Apr-11 20:38 
QuestionSome Questions for LINQ ? Pin
Honeyboy_2020-Apr-11 13:13
Honeyboy_2020-Apr-11 13:13 

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.