// Browses file with OpenFileDialog control private void btnFileOpen_Click(object sender, EventArgs e) { OpenFileDialog openFileDialogCSV = new OpenFileDialog(); openFileDialogCSV.InitialDirectory = Application.ExecutablePath.ToString(); openFileDialogCSV.Filter = "CSV files (*.csv)|*.csv|All files (*.*)|*.*"; openFileDialogCSV.FilterIndex = 1; openFileDialogCSV.RestoreDirectory = true; if (openFileDialogCSV.ShowDialog() == DialogResult.OK) { this.txtFileToImport.Text = openFileDialogCSV.FileName.ToString(); } }
In the above code, I am looking at a file to open. I want to do this, find the file, select it and then click ok. When I click ok, I want to make a copy of the seleted file and provide the .txt extension with this duplicate file. I need help in achieving this.
thanks
source share