i started learning programming a few days ago and i'm working/practicing on a program that copies and pastes several files at the same time, but i'm having trouble when it comes to getting it to work on multiple different extensions
Here's the code
namespace practice
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
public string[] getFlies
{
get;
set;
}
public string getdirectory
{
get;
set;
}
public string[] getextension
{
get;
set;
}
private void button1_Click(object sender, EventArgs e)
{
try
{
OpenFileDialog getfiles = new OpenFileDialog();
getfiles.Filter = "All Files (.)|.";
getfiles.FilterIndex = 1;
getfiles.Multiselect = true;
if (getfiles.ShowDialog() == DialogResult.OK)
{
getFlies = getfiles.FileNames;
foreach (string file_name in getFlies)
{
listBox1.Items.Add(file_name);
getextension = Path.GetExtension(getFlies);
}
}
}
catch
{
MessageBox.Show("Error");
}
}
private void button2_Click(object sender, EventArgs e)
{
FolderBrowserDialog fbb = new FolderBrowserDialog();
fbb.Description = "Select a folder";
if (fbb.ShowDialog() == DialogResult.OK)
{
getdirectory = fbb.SelectedPath;
}
}
private void button3_Click(object sender, EventArgs e)
{
foreach (object item in listBox1.Items)
{
File.Copy(getFlies.ToString(), getdirectory);
}
}
private void button4_Click(object sender, EventArgs e)
{
listBox1.Items.Clear();
}
}
What should I do?