System.Diagnostics.Process p = System.Diagnostics.Process.GetCurrentProcess(); textBox2.Text = p.HandleCount.ToString();