I'm doing something stupid !,

  • Thread starter Thread starter One Handed Man [ OHM# ]
  • Start date Start date
O

One Handed Man [ OHM# ]

I'm doing something stupid !, I must be because this throws no exception, but does not delete the file which "is" there. Amy ideas ?

Try
System.IO.File.Delete("c:\test.txt")

Catch ex As Exception

MessageBox.Show("An error occured :" & ex.Message)

End Try



Regards - OHM#

OneHandedMan{at}BTInternet{dot}com
 
How about this:

If System.IO.File.Exists(file) Then

Try
System.IO.File.Delete("c:\test.txt")

Catch ex As Exception

MessageBox.Show("An error occured :" & ex.Message)

End Try

End If



"One Handed Man [ OHM# ]" <OneHandedMan{at}BTInternet{dot}com> wrote in message I'm doing something stupid !, I must be because this throws no exception, but does not delete the file which "is" there. Amy ideas ?

Try
System.IO.File.Delete("c:\test.txt")

Catch ex As Exception

MessageBox.Show("An error occured :" & ex.Message)

End Try



Regards - OHM#

OneHandedMan{at}BTInternet{dot}com
 
Hi OHM:

I see nothing wrong with this - it worked for me exactly as you have coded it. Could the file be in use? Is some funny attribute set? Try it on a different file.

HTH,

Bernie
"One Handed Man [ OHM# ]" <OneHandedMan{at}BTInternet{dot}com> wrote in message I'm doing something stupid !, I must be because this throws no exception, but does not delete the file which "is" there. Amy ideas ?

Try
System.IO.File.Delete("c:\test.txt")

Catch ex As Exception

MessageBox.Show("An error occured :" & ex.Message)

End Try



Regards - OHM#

OneHandedMan{at}BTInternet{dot}com
 
"One Handed Man [ OHM# ]" <OneHandedMan{at}BTInternet{dot}com> schrieb
I'm doing something stupid !, I must be because this throws no exception,
but does not delete the file which "is" there. Amy ideas ?

Try
System.IO.File.Delete("c:\test.txt")

Catch ex As Exception

MessageBox.Show("An error occured :" & ex.Message)

End Try

========

Can't reprodcue it. Here the file is deleted. (Framework 1.1)
 
I was right, I was doing something stupid. I had named the file test.txt, but the system had added the .txt extension, so the real file name was

test.txt.txt

Greeeeeeeeeeerrrrrrrrrrr <big time embarresed>
Regards - OHM#

OneHandedMan{at}BTInternet{dot}com
Hi OHM:

I see nothing wrong with this - it worked for me exactly as you have coded it. Could the file be in use? Is some funny attribute set? Try it on a different file.

HTH,

Bernie
"One Handed Man [ OHM# ]" <OneHandedMan{at}BTInternet{dot}com> wrote in message I'm doing something stupid !, I must be because this throws no exception, but does not delete the file which "is" there. Amy ideas ?

Try
System.IO.File.Delete("c:\test.txt")

Catch ex As Exception

MessageBox.Show("An error occured :" & ex.Message)

End Try



Regards - OHM#

OneHandedMan{at}BTInternet{dot}com
 
* "One Handed Man said:
I'm doing something stupid !, I must be because this throws no exception, but does not delete the file which
"is" there. Amy ideas ?

 

Try

System.IO.File.Delete("c:\test.txt")

Are you sure the file exists?
 
Back
Top