Duplicate row filtering tool (vs2010.NET source code + tool) is poorly written: (use together :)
Today, I wrote a tool for filtering repeated text in the project. It is estimated that this tool will be used in the future. I will share it here to give you a poor level of programming .. Sorry
Imports System. IO
Imports System. Threading
Public Class Main
Public DoMainAddress As ArrayList = New ArrayList
Public FilePath As String
Private Sub button#click (sender As System. Object, e As System. EventArgs) Handles Button1.Click
If Button1.Text = "select file" Then
If RichTextBox1.Text <> "" Then
RichTextBox1.Text = ""
End If
OpenFileDialog1.Multiselect = True
OpenFileDialog1.Filter = "all files | *.*"
OpenFileDialog1.FileName = ""
OpenFileDialog1.ShowDialog ()
FilePath = OpenFileDialog1.FileName
If OpenFileDialog1.FileName <> "" Then
Dim RunThread As Thread = New Thread (New ThreadStart (AddressOf ReadFile ))
RunThread. Start ()
Button1.Text = "executed"
End If
Else
RichTextBox1.Text = ""
Dim RunThread As Thread = New Thread (New ThreadStart (AddressOf ReadFileRun ))
RunThread. Start ()
Button1.Text = "select file"
End If
End Sub
Public Sub ReadFileRun ()
Dim sr As System. IO. StreamReader = New StreamReader (FilePath, System. Text. Encoding. Default, True)
Do While sr. Peek>-1
Dim Tempsr As String = sr. ReadLine & vbCrLf
If DoMainAddress. Contains (Tempsr) = False Then
DoMainAddress. Add (Tempsr)
End If
Loop
Sr. Close ()
Dim wrstr As String = ""
For I As Integer = 0 To DoMainAddress. Count-1
Wrstr & = DoMainAddress (I). ToString
RichTextBox1.AppendText (I & "" & DoMainAddress (I). ToString)
Next
Dim FileName1 As String = "\ Done.txt"
If File. Exists (Application. StartupPath & "\ Done.txt") = True Then
If MsgBox ("Path:" & Application. StartupPath & FileName1 & "Overwrite existing file?", MsgBoxStyle. YesNo Xor MsgBoxStyle. Information) = MsgBoxResult. Yes Then
FileName1 = "\ Done.txt"
Else
FileName1 = "\ filtered [" & OpenFileDialog1.SafeFileName & "cmd.txt"
End If
End If
Dim wr As StreamWriter = New StreamWriter (Application. StartupPath & FileName1)
Wr. Write (wrstr)
Wr. Close ()
MsgBox ("execution completed" & vbCrLf & "file generation path:" & Application. StartupPath & FileName1, MsgBoxStyle. Information)
End Sub
Public Sub ReadFile ()
Dim sr As System. IO. StreamReader = New StreamReader (FilePath, System. Text. Encoding. Default, True)
Do While sr. Peek>-1
RichTextBox1.AppendText (sr. ReadLine & vbCrLf)
Loop
End Sub
Private Sub Form1_Load (sender As Object, e As System. EventArgs) Handles Me. Load
Checkforillegalcrossthreadcils = False
End Sub
Private Sub usage instructions ToolStripMenuItem_Click (sender As System. Object, e As System. EventArgs) Handles usage instructions ToolStripMenuItem. Click
MsgBox ("1. read and compare by row "& vbCrLf &" 2. press <Select File> and then <Select File> to <execute> click <execute> to generate a done.txt file in the program directory. txt ", 48," By: MythHack ")
End Sub
Private Sub about ToolStripMenuItem_Click (sender As System. Object, e As System. EventArgs) Handles about ToolStripMenuItem. Click
MsgBox ("By: MythHack" & vbCrLf & "www.MythHack.com" & vbCrLf & "2012-05-22", MsgBoxStyle. Information)
End Sub
End Class