Quantcast
Channel: Common Language Runtime Internals and Architecture forum
Viewing all articles
Browse latest Browse all 1710

Why is File.Delete not working

$
0
0

My snippet of code is pasted in below. I have created the file I am trying to delete and then trying to delete it. I depend on it being gone in order to proceed properly. I've taken a directory snapshot to determine if it is really gone and it provides me a null string (usually indicating the absence of the file. However the file remains intact regardless. I've read the thread on this problem but nothing gave me any clue as to how to fix. Spending much too much time on this problem! Can someone tell me what I have missed?

Protected Sub Page_Load(ByVal sender As Object, ByVal e As EventArgs) Handles Me.Load
        Dim s As String, i As Integer, getprop As String, apath, a1, a2 As String
        Dim rootpath = Server.MapPath("~") 'this is the applicaiton's root path
        ChDir(rootpath & "\SDATA")
        ' ChDir("..\sdata")
        s = CurDir()
        TextBox2.Text = s   'should display application'root directory &sdata
        s = Dir("permdb.*")     'should display permdb.out
        rootbox.Text = s
        File.Delete("refresh1005.txt")
        s = Dir("refresh1005.txt")
    End Sub




eps123


Viewing all articles
Browse latest Browse all 1710

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>