Windows Forms: How to make a File Explorer in C#
By FoxLearn 7/15/2017 7:18:17 PM 10.16K
How to make a file explorer in c# using WebBrowser control
Step 1: Click New Project, then select Visual C# on the left, then Windows and then select Windows Forms Application. Name your project "FileExplorer" and then click OK
Step 2: Design your form as below
Step 3: Add code to handle your form
using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System.Text; using System.Threading.Tasks; using System.Windows.Forms; namespace FileExplorer { public partial class Form1 : Form { public Form1() { InitializeComponent(); } private void btnOpen_Click(object sender, EventArgs e) { //Open browser dialog allows you to select the path using(FolderBrowserDialog fbd = new FolderBrowserDialog() { Description="Select your path." }) { if (fbd.ShowDialog() == DialogResult.OK) { webBrowser.Url = new Uri(fbd.SelectedPath); txtPath.Text = fbd.SelectedPath; } } } private void btnBack_Click(object sender, EventArgs e) { if (webBrowser.CanGoBack) webBrowser.GoBack(); } private void btnForward_Click(object sender, EventArgs e) { if (webBrowser.CanGoForward) webBrowser.GoForward(); } } }
VIDEO TUTORIALS
- How to Use Form Load and Button click Event in C#
- How to use Advanced Filter DataGridView in C#
- How to use TagListControl in C#
- How to use Error Provider in C#
- How to Drag and Drop controls in C#
- How to Create a Random Password Generator in C#
- How to make an Application auto run on Windows startup in C#
- How to Create a Wait Form Dialog in C#
Categories
Popular Posts
C# Tutorial
07/20/2024
How to Download Microsoft SQL Server
06/22/2024
Data type SQL Server
02/19/2024