The OpenFileDialog class is defined in Windows.Forms class. You need to add to reference to System.Windows.Form.dll library and call using System.Windows.Forms before using the class.The OpenFileDialog class can be used to open a file similar to CFileDialog's Open method in VC++. This class is derived from FileDialog. OpenFile method of this class opens a file which can be read by a steam.In this sample code, I have use OpenFileDialog class to browse a file.OpenFileDialog fdlg = new OpenFileDialog();fdlg.Title = "C# Corner Open File Dialog" ;fdlg.InitialDirectory = @"c:\" ;fdlg.Filter = "All files (*.*)|*.*|All files (*.*)|*.*" ;fdlg.FilterIndex = 2 ;fdlg.RestoreDirectory = true ;if(fdlg.ShowDialog() == DialogResult.OK){textBox1.Text = fdlg.FileName ;}Title member let you set the title of the open dialog. Filter member let you set a filter for types of files to open.FileName member gives you the name of the selected file.
Browse or Open a File
A GridView Component in C#
In that we should have done button, when we click on done button that should store in that location
i need open a new html file, when i press the button(in new browser)...
hi.. I have one browse button and one text box. In the browse_button click event, I would like to browse the files and place the path name into textbox. For this i'vw written code like this by using openfile dialog.private void brwsbtn_Click(object sender, EventArgs e) { if (openFD.ShowDialog() == DialogResult.OK) { textBox1.Text = openFD.FileName; } textBox1.Text=""; }So that i am able to select files only. how can i select and place the folders path in textbox.In my application the user should able to select either file or folder through a single browse button. please suggest me how to write code for this.thank you
How to browse the multiple files and get the all file names at a time
want to make a GUI to process multiple file.the GUI will have "browse file" button to browse file from drive.help me with the source code as i am newbiee in C#.