I have created a GUI (Windows Form) that has FileBrowserdialogs in which you can choose the folder and display the contents on each listbox respectively. However, I want to compare both list boxes and display the differences in the strings on the third list box by pressing a button. For example:
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)
listBox2.Items.Clear();
listBox2.Items.Add(file);
listBox2.Items.Add(dir);
private void button3_Click(object sender, EventArgs e)