I am having a list box on my form what i need is i would like to display all the text files that are presented in the local drives to that list box on Form Load can any one help me.
I wrote my code like this
string[] filepaths;
filepaths = Directory.GetFiles(@"c:\", "*.txt", SearchOption.AllDirectories);
But this is throwing an error how can i read the files from all directories