-1

I want to mimic the functionality of the following image using Visual C#:

Uploaded image

This I know is not a textbox or a combobox or a richtext (Maybe). I managed to get the add function, where I get directories and I can select them:

private void button8_Click(object sender, EventArgs e)
{
    this.folderBrowserDialog1.ShowNewFolderButton = false;
    this.folderBrowserDialog1.RootFolder = System.Environment.SpecialFolder.MyComputer;
    DialogResult result = this.folderBrowserDialog1.ShowDialog();
    if (result == DialogResult.OK)
    {
        // the code here will be executed if the user selects a folder
        string path = this.folderBrowserDialog1.SelectedPath;
    }
}

How do I list them like in the image, should I write it to an ini file, or XML file, and then if so how do I list it in the box as shown.

I also need to detect the OS and have few default folders in the list.

Yannick Blondeau
  • 9,465
  • 8
  • 52
  • 74

1 Answers1

0

Not quite sure what you want, but the image shows a list with a string and bool value. So you can use something like this:

public class DirOptions
{
    string Path = string.Empty;
    bool IncludeSubDirs = false;
}

Then you can store your data inside a List<>:

var list = new List<DirOptions>();

To detect OS:

Please see this question Get OS Version / Friendly Name in C#

Community
  • 1
  • 1
Alina B.
  • 1,256
  • 8
  • 18