473,385 Members | 1,645 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

I'm doing something stupid !,

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
Nov 20 '05 #1
5 1555
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 news:uI**************@TK2MSFTNGP10.phx.gbl...
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
Nov 20 '05 #2
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 news:uI**************@TK2MSFTNGP10.phx.gbl...
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
Nov 20 '05 #3
"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)
--
Armin

http://www.plig.net/nnq/nquote.html
http://www.netmeister.org/news/learn2quote.html

Nov 20 '05 #4
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
"Bernie Yaeger" <be*****@cherwellinc.com> wrote in message news:uo**************@TK2MSFTNGP12.phx.gbl...
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 news:uI**************@TK2MSFTNGP10.phx.gbl...
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
Nov 20 '05 #5
* "One Handed Man [ OHM# ]" <OneHandedMan{at}BTInternet{dot}com> scripsit:
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?

--
Herfried K. Wagner [MVP]
<http://www.mvps.org/dotnet>
Nov 20 '05 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

383
by: John Bailo | last post by:
The war of the OSes was won a long time ago. Unix has always been, and will continue to be, the Server OS in the form of Linux. Microsoft struggled mightily to win that battle -- creating a...
5
by: Guoqi Zheng | last post by:
I think I have this kind of problem very often, now it is really making me crazy. VS.NET always want to change my html code. Ok, that is fine as long as Vs.Net can ask my confirmaton first. For...
2
by: Ike | last post by:
Im wondering if someone can take a look at this simple INSERT statement which is puking on me. I KNOW I must have something stupid in it that I am NOT seeing, which will likely be obvious to...
28
by: fred.haab | last post by:
Not having server side scripting, I've been doing this for "last modified" tags on my pages: <div class="modified"> <script type="Text/JavaScript"> <!-- document.write("This page was last...
5
by: tom | last post by:
Hi, I'm overriding my operator new and operator delete for two classes, one inherited from the other, so I can use my own memory pool. A simplified version of what I have is below: class...
7
by: smartbeginner | last post by:
I cannot view in the console what all i have included in printf() .Why this? Code: #include<stdio.h> #include<conio.h> #include "SDL/SDL.h" int main(void) { int x=1; SDL_Event event;
5
by: Adrian | last post by:
When I try this on MS C++2005 it takes the bad stream branch, and I have no idea why. Borland and Gcc both do what I would expect. Have I done something stupid? #include <iostream> #include...
2
by: lazukars | last post by:
I have been going over the this code for hours and am baffled. Am I missing something stupid? I am creating dynamic html via innerHTML for a webpage. There is an onClick function in this...
16
by: raylopez99 | last post by:
I am running out of printing paper trying to debug this...it has to be trivial, but I cannot figure it out--can you? Why am I not printing text, but just the initial string "howdy"? On the...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.