How to add second column to a listBox component?
For the moment I can only get the subfolders name of C:\Backup folder to the first column of the listBoxComputer.
Have do I get also the last written date of subfolders to the second column of the listBoxComputer?
Code:
private string rootDir = @"C:\Backup";
private void FormView_Load(object sender, EventArgs e) {
List<string> ls = Directory.GetDirectories(rootDir).Select(Path.GetFileName).ToList();
ls.Sort((a, b) => -1 * a.CompareTo(b));
listBoxComputer.Sorted = false;
listBoxComputer.DataSource = ls;
listBoxUser.SelectedIndex =-1;
}
Re: How to add second column to a listBox component?
You are using the wrong control as the list box only has 1 one column. You will need to use a listview control instead. The listview control allows for multiple columns. https://docs.microsoft.com/en-us/dot...ramework-4.7.2