Advertisement
Maglietta

Untitled

Nov 14th, 2018
5,135
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.98 KB | None | 0 0
  1. Imports System.Text.RegularExpressions
  2. Public Class Form1
  3. Dim diff1 As String = ""
  4. Dim diff2 As String = ""
  5. Dim output As System.IO.StreamWriter
  6. Dim result As String = Environment.GetFolderPath(Environment.SpecialFolder.Desktop) + "\" + "Compared Strings.txt"
  7. Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
  8. OpenFileDialog1.Filter = " | *.txt"
  9. If OpenFileDialog1.ShowDialog = DialogResult.OK Then
  10. TextBox1.Text = My.Computer.FileSystem.ReadAllText(OpenFileDialog1.FileName)
  11. End If
  12.  
  13. End Sub
  14. Private Sub Button2_Click(sender As Object, e As EventArgs) Handles Button2.Click
  15. OpenFileDialog2.Filter = " | *.txt"
  16. If OpenFileDialog2.ShowDialog = DialogResult.OK Then
  17. TextBox2.Text = My.Computer.FileSystem.ReadAllText(OpenFileDialog2.FileName)
  18. End If
  19. End Sub
  20.  
  21. Private Sub Button3_Click(sender As Object, e As EventArgs) Handles Button3.Click
  22.  
  23. Dim txt1(TextBox1.Text.Split(" ").Length) As String
  24.  
  25. Dim txt2(TextBox2.Text.Split(" ").Length) As String
  26.  
  27. txt1 = TextBox1.Text.Split(" ")
  28.  
  29. txt2 = TextBox2.Text.Split(" ")
  30.  
  31.  
  32. For Each diff As String In txt2
  33.  
  34. If Array.IndexOf(txt1, diff.ToString) = -1 Then
  35. diff2 += diff.ToString() & "<======DIFFERENT STRING"
  36. End If
  37. TextBox3.Text = diff2.ToString()
  38.  
  39. Next
  40. test()
  41.  
  42. filecrt()
  43. End Sub
  44.  
  45. Private Sub test()
  46. Dim lines As New List(Of String)
  47. lines = TextBox3.Lines.ToList
  48. Dim FilterText = "<==="
  49. For i As Integer = lines.Count - 1 To 0 Step -1
  50. If Not Regex.IsMatch(lines(i), FilterText) Then
  51. lines.RemoveAt(i)
  52. End If
  53. Next
  54. TextBox3.Lines = lines.ToArray
  55. End Sub
  56. Private Sub filecrt()
  57. My.Computer.FileSystem.WriteAllText(result, TextBox3.Text, False)
  58. End Sub
  59. End Class
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement