-2
Adding the name of some files in a folder to a "Checked List Box" does not show anything in the List Box.
ListBox mylist = new ListBox();
DirectoryInfo d = new DirectoryInfo(@"C:\Program Files (x86)\Nmap\scripts");
FileInfo[] Files = d.GetFiles("*.nse");
string str = "";
foreach (FileInfo file in Files)
{
mylist.Items.Add(file);
}
checkedListBox1.Items.Add(mylist);
I am using this code when run appears like this:
is doing exactly what it should, because Fileinfo is an object, a class. If you are expecting information from the archive, such as its name, please read the documentation to better understand: https://docs.microsoft.com/en-us/dotnet/api/system.io.fileinfo?view=netframework-4.8 maybe what you want is to
mylist.Items.Add(file.Name)
– Ricardo Pontual