Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR CSHARP

How to delete File in c#

string gpath;

        string path=@"c:UsersAdamDesktop";

        string name="file";

        string f="";

        int i=0;

        string ext=".txt";

        while(File.Exists(path + name + f + ext))
        {
            i++;

            f = i.ToString();
        }

        gpath = path + name + f + ext;

        button2.Enabled = true;

        File.Create(gpath);

        File.Delete(gpath);//why there is an Error??
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #How #delete #File
ADD COMMENT
Topic
Name
3+2 =