Get differences between two RichTextBox [VB.NET] RRS feed

  • Question

  • Hi guys, I'm wondering how it comes to be so hard to get the differences between two rtb. I've been surfing all over to find middle examples that are not working.

    So I decided to open my thread and ask to you.

    How can I get the differences between two Richtextboxes and display them on a third richtextbox.

    Richtextbox1 and the 2nd  they  cointain almost the same text around 10k characters. Numbers and special characters too.


    RTB1 TEXT=


    Then the 3 rd Richtextbox should filter like:





    Basically everytime I update Richtextbox1 I wanna know which changes has been made with the previous one. 

    I tried different codes that are easily to find if somebody got my same problem, so I'm avoiding to copy the same code that there is out there.

    How do you guys advise me to do?


    Have a good day

    Wednesday, June 17, 2020 6:43 PM


All replies

  • Hi

    You may need to be more specific.  In your example, RTB1 contains 12345 and RTB2 doesnt, so that should be in the RTB3 shouldn't it? Unless you specify that difference filter  is ONLY items in RTB2 which are not in RTB1


    RTB1 contains *NEW* but RTB2 has that with leading spaces , so that should be in the RTB3 shouldn't it?  Unless you specify leading (and trailing) spaces to be ignored.


    In your example, youlist BUT in RTB3 - where did that come from?


    In other words, you must be more exact in your requirements.

    Regards Les, Livingston, Scotland

    Wednesday, June 17, 2020 6:52 PM
  • Hi Leshay,

    you are right. Sorry.

    I will explain better so It will be easier to make my point.

    I'm downloading with webrequest a text from a page in textuploader.com

    So, every 5 seconds I'm checking if there is a change on the text. 

    If there is a change then, I want to see the Changes in the 3rd Rithtextbox. Thanks 

    Wednesday, June 17, 2020 7:09 PM
  • Hi

    Sorry, you still have not explained sufficiently. Please give step by step what happens.

    1. Download into RTB1

    2. 5 second later, download into RTB2

    3. Check for differences and put into RTB3

    4. copy RTB2 into RTB1 and clear RTB2

    5. goto 2

    Or, something different?

    Regards Les, Livingston, Scotland

    • Edited by leshay Wednesday, June 17, 2020 7:33 PM
    Wednesday, June 17, 2020 7:32 PM
  • Hi leshay,

    still sorry about this.

    I'm using a 2nd Richtextbox because  I want the old update dates too, that's why I then compare the updated one (RTB1)  to (RTB2).

    So the steps to do at the first opening are:

    (both RTB empty in the beginning)

    - Download into RTB1 that will be saved into my.settings during form.closing. 

    then, When I re-open the software It should be :

    (RTB1 Empty) ( RTB2 old dates)

    -Download into RTB1

    - If RTB1 is different from RTB2 then

    show differences in RTB3.

    p.s. Dates will be saved all the time at the time of form.closing, displaying them at the reopening in the RTB2.

    also, there will be around 5 updates for day. 

    Hope now it's more clear.


    Mattia Fanti

    Wednesday, June 17, 2020 8:03 PM
  • Hi

    Sorry, although it is a little clearer, there are still problems.

    You now start to talk about Dates - with no explanation!

    You say ;When I re-open the software It should be :

    (RTB1 Empty) ( RTB2 old dates)   ----   what?

    Using the term old Dates means absolutely nothing!

    It isn't hard to do a step by step procedure for most people.

    Regards Les, Livingston, Scotland

    Wednesday, June 17, 2020 8:14 PM
  • Hi leshay,

    I'm sorry I can't explain you better the situation, but I thought I was clear at this step.

    With the term Old dates I'm referring to old updates I had from the page.

    I need two element in order to compare, so if If RTB2 will be empty, how can I compare it?

    RTB2 will display everytime the old update while RTB1 the new one.

    Hope now it's clear.


    Wednesday, June 17, 2020 8:34 PM
  • Hi

    No, sorry, it is far from clear.

    Maybe someone else can assist,I am unable to.

    Regards Les, Livingston, Scotland

    Wednesday, June 17, 2020 8:49 PM
  • Hi leshay,

    exactly what you don't understand?

    Imagine I create a text on https://textuploader.com/

    and you wanna get alerted every time i change part of it. You want also to see which modifies have been made

    How do you solve it?

    the rtb and the other stuff I created because it was my idea. I'm sure it's plenty of ways to make it works.


    Wednesday, June 17, 2020 9:20 PM
  • Hi

    Please post the code you are using to download the data.

    Regards Les, Livingston, Scotland

    Wednesday, June 17, 2020 9:30 PM
  • hi leshay,

     Dim sourceString As String = New System.Net.WebClient().DownloadString("https://textuploader.com/1h28a/raw")

    this is the code I use . 


    Wednesday, June 17, 2020 9:38 PM
  • Hi

    We would need a site where we can both have permission to download. The site you have given is secured. It doesn't matter what the data is, just provide any site that we can both get the same data from.

    Regards Les, Livingston, Scotland

    Wednesday, June 17, 2020 9:48 PM
  • Hi leshay,

    what do you mean?

    If you go on https://textuploader.com/1h28a/raw you can easily take the text. I don't know which kind of secure you mean.

    Anyway I think we are going a bit off topic.

    The title in the thread is get differences between two richtextbox, not the entire project.

    Anyway, I appreciated for your time, and I hope there is someone else that could assist me on this problem.



    Wednesday, June 17, 2020 10:28 PM
  • Hi

    So, you supply a non-usable URL, and when I point thast out, you edit your post to a different URL and then make out it was OK all along.

    OK, see if someone else is willing to take on your problem and your attitude.

    Regards Les, Livingston, Scotland

    Wednesday, June 17, 2020 11:05 PM
  • Hi leshay,

    I supply a simple url to make an example, but you can create your own note and try by yourself ( if you want).

    Url doesn't matter, I already know how to take the text.

    I don't know why you are sitting on this point.

    Which attitude you are talking about? I'm gently asking and trying to give as much information as possible. I think you got the problem, you just had a bad day.

    Thanks anyway


    Wednesday, June 17, 2020 11:15 PM
  • Hi, for whoever want the solution, here it is 


    • Marked as answer by Mattia Fanti Friday, June 19, 2020 12:20 AM
    Thursday, June 18, 2020 5:36 PM