|
web
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
Does file existThanks for the reply, I have been trying that, but I keep getting the same
results. The result I get is that the file exits, when it really doesn't. All my msgbox display twice and I'm not sure why. Here is the code I'm using. Can you help? Public Const fnet As String = "\\server1\images" Public pfile As String = "TEST01.TXT" Private Sub DoesExist() If System.IO.File.Exists(fnet & "\" & pfile) Then MessageBox.Show(fnet & "\" & pfile & " file does not exist") Else MessageBox.Show(fnet & "\" & pfile & " file does exist") End If End Sub Mike,
You have got your messages mixed up. It should be: If System.IO.File.Exists(fnet & "\" & pfile) Then MessageBox.Show(fnet & "\" & pfile & " file DOES exist") Else MessageBox.Show(fnet & "\" & pfile & " file does NOT exist") End If Kerry Moorman Show quoteHide quote "Mike" wrote: > Thanks for the reply, I have been trying that, but I keep getting the same > results. The result I get is that the file exits, when it really doesn't. > All my msgbox display twice and I'm not sure why. Here is the code I'm > using. Can you help? > > Public Const fnet As String = "\\server1\images" > Public pfile As String = "TEST01.TXT" > Private Sub DoesExist() > > If System.IO.File.Exists(fnet & "\" & pfile) Then > > MessageBox.Show(fnet & "\" & pfile & " file does not exist") > Else > MessageBox.Show(fnet & "\" & pfile & " file does exist") > End If > > End Sub > > > > Bear in mind that if File.Exists returns false it doesn't necessarily mean
that the file does not exist; it could mean that the caller has insufficient permissions to actually test for the existence of the file. If File.Exists is being used to determine whether or not a file needs to be created, it's possible for the file creation to fail. -- Show quoteHide quoteKevin Westhead "Kerry Moorman" <KerryMoor***@discussions.microsoft.com> wrote in message news:4380C96E-448E-43C3-9AFC-7E465AC0092F@microsoft.com... > Mike, > > You have got your messages mixed up. It should be: > > If System.IO.File.Exists(fnet & "\" & pfile) Then > > MessageBox.Show(fnet & "\" & pfile & " file DOES exist") > Else > MessageBox.Show(fnet & "\" & pfile & " file does NOT exist") > End If Hello, Mike,
Is it possible that you're just suffering a proofreading lapse? It looks to me like the code you posted will report the message opposite to the one you would normally want. Cheers, Randy Mike wrote: Show quoteHide quote > Thanks for the reply, I have been trying that, but I keep getting the same > results. The result I get is that the file exits, when it really doesn't. > All my msgbox display twice and I'm not sure why. Here is the code I'm > using. Can you help? > > Public Const fnet As String = "\\server1\images" > Public pfile As String = "TEST01.TXT" > Private Sub DoesExist() > > If System.IO.File.Exists(fnet & "\" & pfile) Then > > MessageBox.Show(fnet & "\" & pfile & " file does not exist") > Else > MessageBox.Show(fnet & "\" & pfile & " file does exist") > End If > > End Sub > > >
String wierdness...
Access database insert statement with an autonumber (identity) in vb.net Data base insert Error HELP! Is there a Forms collection? Datagrid current row edits Thread Question Thread question trying to download VS2005 from MSDN Converting Code from VBA to VB.NET Is RegEx a good choice for reading malformed xml? |
|||||||||||||||||||||||