First of all we should get a directory by the user. then in the specified folder we want to search a file by its name or its extension. for example in that folder we want to search a name "Book" or an extension like .txt . Suppose that we have a Browse button, and by clicking on it we get the path and show it in a label(in the below code it is label1). and we have a Search button and a textBox that we should write the name or extension in textBox and by clicking on Search button the result(the founded files' names) would be shown in a MessageBox.
i have written a piece of code that only gets the path and i don't know how to write the rest.
private void Browse_Click(object sender, EventArgs e) { if (folderBrowserDialog1.ShowDialog() == DialogResult.OK) { this.label1.Text = folderBrowserDialog1.SelectedPath; Directory = label1.ToString(); } }