Hello,
I need some guidance with my third button. I have created a GUI that so far displays contents from from two folders by using folder browser dialog. All I want to do is compare the filenames between both folders and display the differences in a third listbox. I would like to add messages like "Differences"= string list. Any help would be appreciated.Below is my current code:
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using System.IO;
namespace WindowsFormsApplication3
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void button1_Click(object sender, EventArgs e)
{
FolderBrowserDialog FBD = new FolderBrowserDialog();
if (FBD.ShowDialog() == DialogResult.OK)
{
listBox1.Items.Clear();
string[] files = Directory.GetFiles(FBD.SelectedPath);
string[] dirs = Directory.GetDirectories(FBD.SelectedPath);
foreach (string file in files)
{
listBox1.Items.Add(file);
}
foreach (string dir in dirs)
{
listBox1.Items.Add(dir);
}
}
}
private void button2_Click(object sender, EventArgs e)
{
FolderBrowserDialog FBD = new FolderBrowserDialog();
if (FBD.ShowDialog() == DialogResult.OK)
{
listBox2.Items.Clear();
string[] files = Directory.GetFiles(FBD.SelectedPath);
string[] dirs = Directory.GetDirectories(FBD.SelectedPath);
foreach (string file in files)
{
listBox2.Items.Add(file);
}
foreach (string dir in dirs)
{
listBox2.Items.Add(dir);
}
}
{
}
}
private void button3_Click(object sender, EventArgs e)
{
}
}
}