I have a WPF application with a csv file that gets displayed in a texbox when the application is loaded, like so:
private void Window_Loaded(object sender, RoutedEventArgs e)
{
path = @"C:\Users\user\Documents\app\mainFile.csv";
mainFile = File.ReadAllText(path);
txtDisplay.Text = mainFile;
}
Also, I have 2 buttons: Upload and Compare. The upload button has the following code:
private void btnUpload_Click(object sender, RoutedEventArgs e)
{
OpenFileDialog openFileDialog = new OpenFileDialog();
if(openFileDialog.ShowDialog() == true)
{
compareFile = File.ReadAllText(openFileDialog.FileName);
MessageBox.Show("File Uploaded");
}
}
Once a file is uploaded it gets stored in the compareFile variable. What I want to do is, once the compare button is clicked, the 2 files (mainFile and compareFile) to be compared and output the non-matching lines into another CSV file. I was hoping someone could point me in the right direction to solving this, I have little to no programming experience, so any help is appreciated.
Here are the CSV files just in case you needed to see the format:
compareFile
id,firstname,lastname,email,city
10,Jaime,Odell,[email protected],Lagos
11,Charlena,Birdella,[email protected],Liverpool
12,Kristan,Phaidra,[email protected],Innsbruck
13,Annecorinne,Lay,[email protected],San Juan
14,Dotty,Sidonius,[email protected],Curitiba
15,Mellicent,Maurine,[email protected],Rio de Janeiro
16,Bill,Khorma,[email protected],Dongguan
17,Kary,Nicoline,[email protected],Zagreb
18,Karena,Martguerita,[email protected],Mexico City
19,Antonietta,Thunell,[email protected],Kandy
mainFile
id,firstname,lastname,email,city
10,Jaime,Odell,[email protected],Lagos
11,Charlena,Birdella,[email protected],Liverpool
12,Kristan,Phaidra,[email protected],Innsbruck
13,Keelia,Callista,[email protected],Gibraltar
14,Binny,Boycey,[email protected],Adelaide
15,Therine,Euridice,[email protected],Shenyang
16,Belinda,Olympium,[email protected],Maseru
17,Kary,Nicoline,[email protected],Zagreb
18,Karena,Martguerita,[email protected],Mexico City
19,Antonietta,Thunell,[email protected],Kandy