Showing the name of the first file in a folder as the first value in a combo box
Posted on 2005-05-09
I have a form load event which grabs all the files in a folder and list the names in a combo box. Anytime my form loads, it comes up with a blank default value in the combo box and i will have to click on the combo box to select a file. I want to be able to have the first file in my folder to be the default file when the form loads. Any help please?
private void Form1_Load(object sender, System.EventArgs e)
DirectoryInfo myfolder = new DirectoryInfo(System.Windows.Forms.Application.StartupPath);
foreach(FileInfo nextFile in myfolder.GetFiles("*.txt"))
stringfileName = nextFile.Name.Split('.');