How to Delete a File – C# C Sharp Visual Studio 2008

11
1



In this tutorial I show you how to delete a file and use some of the other great methods of the File IO class.

WEBSITE:

FORUMS

FREE CODE SNIPPETS

Nguồn:https://wijstaanvooronzegrondrechten.org/

Xem Thêm Bài Viết Khác:https://wijstaanvooronzegrondrechten.org/cong-nghe

11 COMMENTS

  1. Hey, great videos 🙂

    I have a simple question.. I noticed you can't select folders when using the OpenFileDialog function. Is there an alternative that allows you to select a folder instead of a file?

    Thanks.

  2. @hondast90 You can replace the string I pass to "File.Create()" with one provided by the user through something like a textbox or readline from the Console. Remember to include the absolute path prepended to the file name unless you want the file to be created in the directory of the folder.

    For example if the user entered text into textBox1

    File.Create("H:\" + textBox1.Text + ".txt");

LEAVE A REPLY

Please enter your comment!
Please enter your name here