C# File Windows Form

Delete a File in C# Using OpenFileDialog

In this example, we will learn how to delete a selected file with OpenFileDialog.

An OpenFileDialog control is used to browse and select a file on a computer. We can create an OpenFileDialog control using a Forms designer at design-time or using the OpenFileDialog class in code at run-time (also known as dynamically).

Form Design:

 

Source Code:

 

 

Output:

Leave a Comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.