Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Imports System.Text.RegularExpressions
- Public Class Form1
- Dim diff1 As String = ""
- Dim diff2 As String = ""
- Dim output As System.IO.StreamWriter
- Dim result As String = Environment.GetFolderPath(Environment.SpecialFolder.Desktop) + "\" + "Compared Strings.txt"
- Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
- OpenFileDialog1.Filter = " | *.txt"
- If OpenFileDialog1.ShowDialog = DialogResult.OK Then
- TextBox1.Text = My.Computer.FileSystem.ReadAllText(OpenFileDialog1.FileName)
- End If
- End Sub
- Private Sub Button2_Click(sender As Object, e As EventArgs) Handles Button2.Click
- OpenFileDialog2.Filter = " | *.txt"
- If OpenFileDialog2.ShowDialog = DialogResult.OK Then
- TextBox2.Text = My.Computer.FileSystem.ReadAllText(OpenFileDialog2.FileName)
- End If
- End Sub
- Private Sub Button3_Click(sender As Object, e As EventArgs) Handles Button3.Click
- Dim txt1(TextBox1.Text.Split(" ").Length) As String
- Dim txt2(TextBox2.Text.Split(" ").Length) As String
- txt1 = TextBox1.Text.Split(" ")
- txt2 = TextBox2.Text.Split(" ")
- For Each diff As String In txt2
- If Array.IndexOf(txt1, diff.ToString) = -1 Then
- diff2 += diff.ToString() & "<======DIFFERENT STRING"
- End If
- TextBox3.Text = diff2.ToString()
- Next
- test()
- filecrt()
- End Sub
- Private Sub test()
- Dim lines As New List(Of String)
- lines = TextBox3.Lines.ToList
- Dim FilterText = "<==="
- For i As Integer = lines.Count - 1 To 0 Step -1
- If Not Regex.IsMatch(lines(i), FilterText) Then
- lines.RemoveAt(i)
- End If
- Next
- TextBox3.Lines = lines.ToArray
- End Sub
- Private Sub filecrt()
- My.Computer.FileSystem.WriteAllText(result, TextBox3.Text, False)
- End Sub
- End Class
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement