M
Mattia Fanti
Guest
This might seems the classic find differences between two richtextboxes, but I really tried my best before to ask this question. I have 3 richtextboxes. In first rtb I am filling it with a list of names like:
a
b
c
d
e
f
g
In second rtb I am updating the list of names like:
a
b
c
d
e
Private
h
In the third rtb I am writing the differences/changes between the two rtbs. For example g has been eliminated in this case. h has been added Also, I want to detect when a name become "Private". In this case f became Private.
The code I am using it is working properly just when something is being added/removed, So, I am not able to detect Which of the previous names is now Private.
For i As Integer = 0 To RichTextBox1.Lines.Count - 1
If Not RichTextBox2.Lines.Contains(RichTextBox1.Lines(i)) Then
RichTextBox3.AppendText(RichTextBox1.Lines(i) & "has been eliminated" & vbCrLf)
End If
Next
For i As Integer = 0 To RichTextBox2.Lines.Count - 1
If RichTextBox2.Lines(i).StartsWith("Privat") Then
RichTextBox3.AppendText("Private video")
End If
Next
For i As Integer = 0 To RichTextBox2.Lines.Count - 1
If Not RichTextBox1.Lines.Contains(RichTextBox2.Lines(i)) And Not RichTextBox2.Lines(i).StartsWith("Privat") Then
RichTextBox3.AppendText(RichTextBox2.Lines(i) & "has been added" & vbCrLf)
'update also rtb1 with good new names.
RichTextBox1.AppendText(vbCrLf & RichTextBox2.Lines(i))
End If
Next
The scope of my program is to scrap the video titles of a youtube playlist. I often realize youtube is deleting videos, or videos are being setted as private. So, I am doing a backup of videos titles. If, tomorrow youtube delete a video, I want to know which video. Deleted videos are easily detectable as they are not appearing in the list while I am updating titles, so my code will detect them as "eliminated", while if tomorrow a video is being set as Private Videos, unfortunately it will appear on the list with the name of "Private Videos". So I must filter them, but how? How can I detect which previous title is now Private? As you can see, the last part of my code is adding to rtb1 the good new added titles, but no "Private videos" of course.Thanks a lot, Hope I explained it clearly.
Continue reading...
a
b
c
d
e
f
g
In second rtb I am updating the list of names like:
a
b
c
d
e
Private
h
In the third rtb I am writing the differences/changes between the two rtbs. For example g has been eliminated in this case. h has been added Also, I want to detect when a name become "Private". In this case f became Private.
The code I am using it is working properly just when something is being added/removed, So, I am not able to detect Which of the previous names is now Private.
For i As Integer = 0 To RichTextBox1.Lines.Count - 1
If Not RichTextBox2.Lines.Contains(RichTextBox1.Lines(i)) Then
RichTextBox3.AppendText(RichTextBox1.Lines(i) & "has been eliminated" & vbCrLf)
End If
Next
For i As Integer = 0 To RichTextBox2.Lines.Count - 1
If RichTextBox2.Lines(i).StartsWith("Privat") Then
RichTextBox3.AppendText("Private video")
End If
Next
For i As Integer = 0 To RichTextBox2.Lines.Count - 1
If Not RichTextBox1.Lines.Contains(RichTextBox2.Lines(i)) And Not RichTextBox2.Lines(i).StartsWith("Privat") Then
RichTextBox3.AppendText(RichTextBox2.Lines(i) & "has been added" & vbCrLf)
'update also rtb1 with good new names.
RichTextBox1.AppendText(vbCrLf & RichTextBox2.Lines(i))
End If
Next
The scope of my program is to scrap the video titles of a youtube playlist. I often realize youtube is deleting videos, or videos are being setted as private. So, I am doing a backup of videos titles. If, tomorrow youtube delete a video, I want to know which video. Deleted videos are easily detectable as they are not appearing in the list while I am updating titles, so my code will detect them as "eliminated", while if tomorrow a video is being set as Private Videos, unfortunately it will appear on the list with the name of "Private Videos". So I must filter them, but how? How can I detect which previous title is now Private? As you can see, the last part of my code is adding to rtb1 the good new added titles, but no "Private videos" of course.Thanks a lot, Hope I explained it clearly.
Continue reading...