File Comparison logic

Feb 4 2010 9:24 AM
Hi,

Anyone know the file comparison logic.

In c# windows application, in the form, i have two combobox. let us consider leftcombobox and rightcombobox.  (It contains the file path C:\abc.txt)

Below that I have two richtextbox, for eg, leftRichTextbox and rightRichTextbox.

Combobox contains filename. If I have selected one file, the file content should display in the respective richtextbox.

Here I want to compare both the file content. If there is any difference, I need to differentiate it while displaying the content. By changing color or make it as bold something like that.

For eg:

ComboBox             c:\abc.txt                                                  c:\xyz.txt
LineNo   Content of LeftRichTextbox                              Content of RightRichTextbox

      1       This is a sample file in left                                  Hi
      2       LeftRichTextbox                                                 Hello
      3                                                                                 This is a sample file in right
      4      Thanks To All                                                       RightRichTextBox
      5      IN CAPS                                                               in caps                                     6      Bye All                                                                 Thanks


Result :

LNo       LeftRichTextBox                                                  RightRichTextBox
1                                                                                       Hi
2                                                                                       Hello
3        This is the sample file in left                                 This is the sample file in right
4        LeftRichTextbox                                                    RightRichTextBox
5
6        Thanks To All
7        IN CAPS                                                                in caps
8        Bye All
9                                                                                     Thanks

Note: In Result, in lineNo.5, in the LeftRichTextBox it should display the empty line in different color. (I want to differentiate the empty line also)

I need the file comparison logic.

If anyone knows the logic in some other language like 'C', kindly send me the link.

Thanks.

Answers (1)