Show Combobox with a list of directories

Satyapriyanayak
Posted by Satyapriyanayak under C# category on | Points: 40 | Views : 850
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.IO;
namespace Search_Edit
{
public partial class Form2 : Form
{
public Form2()
{
InitializeComponent();
}

private void Form2_Load(object sender, EventArgs e)
{
DirectoryInfo obj = new DirectoryInfo("D:\\");
DirectoryInfo[] folders = obj.GetDirectories();
comboBox1.DataSource = folders;
}
}
}

Comments or Responses

Login to post response