Question: this is c# below is code that will load background process kinda like a task manager. But I need to change it to where the

this is c# below is code that will load background process kinda like a task manager. But I need to change it to where the program updates the form in real-time instead of me clicking the refresh button. any help would be greatthis is c# below is code that will load background process kindalike a task manager. But I need to change it to wherethe program updates the form in real-time instead of me clicking the

1 2 3 4 5 using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System.Text; using System.Threading.Tasks; using System.Windows.Forms; using System.Diagnostics; 6 7 8 9 10 11 12 13 14 15 gnamespace eventwatcher2 { 3 references B public partial class Form1 : Form { 1 reference public Form1() { InitializeComponent(); } 16 17 18 19 28 2 references private void Form1_Load(object sender, EventArgs e)//grab background process and display them in the listbox { try { Process[] processList = Process.GetProcesses(); foreach (Process process in processList) 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 listBox1.Items.Add(string.Format(@"{@} | ID: {1} ", process.ProcessName, process. Id)); } } catch (InvalidOperationException) { } 1 reference private void refreshButton_Click(object sender, EventArgs e) //refresh button { listBox1.Items.Clear(); Form1_Load(null, EventArgs. Empty); 36 37 38 39 40 41 42 43 44 1 Formi jhi_service ID: 4308 NVIDIA ShareID: 17872 svchost ID: 8616 Spotify IID: 26572 firefox ID: 13784 Runtime Broker ID: 23696 Wmi PrvSEID: 5592 svchost ID: 1712 conhost ID: 24932 Setting Sync Host ID: 16792 firefox ID: 13992 Comp Pkg Srv I ID: 1704 svchost ID: 8132 Runtime Broker ID: 404 Nis Srv ID: 12900 Isass ID: 832 svchost ID: 7296 sihost ID: 23668 smartscreen I ID: 4804 eventwatcher2 ID: 26252 dllhost ID: 4540 svchost ID: 3368 services ID: 820 Runtime Broker ID: 24092 csrss ID: 12452 ctfmon ID: 8140 dwm ID: 13060 Service Hub.Host.CLRx86|ID: 15896 Service Hub.Identity Host ID: 19064 svchost ID: 11584 AGSService ID: 3824 Gaming Services NetID: 5116 Searchindexer | ID: 13304 svchost ID: 4252 Blitz ID: 10144 svchost ID: 3816 winlogon 1 ID: 10640 firefox ID: 18468 svchost ID: 2044 svchost ID: 15880 svchost ID: 20188 Refresh 1 2 3 4 5 using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System.Text; using System.Threading.Tasks; using System.Windows.Forms; using System.Diagnostics; 6 7 8 9 10 11 12 13 14 15 gnamespace eventwatcher2 { 3 references B public partial class Form1 : Form { 1 reference public Form1() { InitializeComponent(); } 16 17 18 19 28 2 references private void Form1_Load(object sender, EventArgs e)//grab background process and display them in the listbox { try { Process[] processList = Process.GetProcesses(); foreach (Process process in processList) 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 listBox1.Items.Add(string.Format(@"{@} | ID: {1} ", process.ProcessName, process. Id)); } } catch (InvalidOperationException) { } 1 reference private void refreshButton_Click(object sender, EventArgs e) //refresh button { listBox1.Items.Clear(); Form1_Load(null, EventArgs. Empty); 36 37 38 39 40 41 42 43 44 1 Formi jhi_service ID: 4308 NVIDIA ShareID: 17872 svchost ID: 8616 Spotify IID: 26572 firefox ID: 13784 Runtime Broker ID: 23696 Wmi PrvSEID: 5592 svchost ID: 1712 conhost ID: 24932 Setting Sync Host ID: 16792 firefox ID: 13992 Comp Pkg Srv I ID: 1704 svchost ID: 8132 Runtime Broker ID: 404 Nis Srv ID: 12900 Isass ID: 832 svchost ID: 7296 sihost ID: 23668 smartscreen I ID: 4804 eventwatcher2 ID: 26252 dllhost ID: 4540 svchost ID: 3368 services ID: 820 Runtime Broker ID: 24092 csrss ID: 12452 ctfmon ID: 8140 dwm ID: 13060 Service Hub.Host.CLRx86|ID: 15896 Service Hub.Identity Host ID: 19064 svchost ID: 11584 AGSService ID: 3824 Gaming Services NetID: 5116 Searchindexer | ID: 13304 svchost ID: 4252 Blitz ID: 10144 svchost ID: 3816 winlogon 1 ID: 10640 firefox ID: 18468 svchost ID: 2044 svchost ID: 15880 svchost ID: 20188 Refresh

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!