Answered step by step
Verified Expert Solution
Question
1 Approved Answer
this is a c# program I'm having an issue with trying to display a listbox that shows the background process. the first image shows that
this is a c# program I'm having an issue with trying to display a listbox that shows the background process.
the first image shows that it has an issue with not having a main. so in the snd image, I put one in and try to run the program nothing happens I'm at a loss on how to fix this
1 2 3 5 6 7 8 9 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; 11 12 13 14 namespace Windows FormsApp2 25 2 references public partial class Form1 : Form { O references public Form1() 17 18 19 20 21 InitializeComponent(); O references private void Form1_Load(object sender, EventArgs e) Process[] processList = Process.GetProcesses(); foreach (Process process in processList) listBox1.Items.Add(string.Format(@"{0} | ID: {1} | Status {2} | Memory (private working set in Bytes) {3}", 22 23 24 25 26 27 28 29 38 31 32 33 34 35 36 process. ProcessName, process. Id, process. Responding, process.PrivateMemorySize64)); No issues found Ln: 21 Ch: 9 SPC CRLF Search Error List O. Solution X 1 Error A 0 Warnings O Messages Build + IntelliSense * Code Description CS5001 Program does not contain a static "Main' method suitable for an entry point Project WindowsFormsApp2 File CSC Line Suppression State 1 Active Form1_Load(object sender, EventArgs e) 4 CH WindowsFormsApp2 * WindowsFormsApp2.Formi using System.Collections.Generic; 3 using System.ComponentModel; using System.Data; 5 using System.Drawing; 6 using System.Linq; 7 using System.Text; 8 using System.Threading.Tasks; 9 using System.Windows.Forms; 10 Lusing System.Diagnostics; 11 12 13 namespace Windows FormsApp2 14 { 2 references 15 e public partial class Form1 : Form 16 O references 17 public Form1() 18 19 InitializeComponent(); 20 } O references 21 static void Main(string[] args) { } O references 22 private void Form1_Load(object sender, EventArgs e) Process[] processList - Process.GetProcesses(); foreach (Process process in processList) { listBox1.Items.Add(string.Format(@"{@} | ID: {1} | Status {2} | Memory (private working set in Bytes) {3}", process.ProcessName, process. Id, process. Responding, process. PrivateMemorySize64)); } 36 104 % No issues found In: 32 Ch: 13 SPC CRLF Output ex Show output from: Debug 'WindowsFormsApp2.exe' (CLR v4.0.30319: DefaultDomain): Loaded 'C:\WINDOWS\Microsoft.Net\assembly\GAC_32\mscorlib\v4.0_4.0.0.0_b77a5c561934e089\mscorlib.dll'. Skipped loading symbols. Module is optimized and the debugger opt: 'WindowsFormsApp2.exe' (CLR v4.0.30319: DefaultDomain): Loaded "C:\Users\halod source epos\Windows FormsApp2\windowsFormsApp2\bin\Debug\WindowsFormsApp2.exe'. Symbols loaded. 'WindowsFormsApp2.exe' (CLR v4.0.30319: Windows FormsApp2.exe): Loaded "C:\WINDOWS\Microsoft.Net\assembly\GAC_MSIL\System.Windows.Forms\v4.0_4.0.0.2__b77a5c561934e089\System.Windows.Forms.dll'. Skipped loading symbols. Module 'WindowsFormsApp2.exe' (CLR v4.0.30319: Windows FormsApp2.exe): Loaded "C:\WINDOWS\Microsoft.Net\assembly\GAC_MSIL\System\v4.0_4.2.8.e_b77a5c561934e089\System.dll'. Skipped loading symbols. Module is optimized and the debugger 'Windows FormsApp2.exe (CLR v4.0.30319: Windows FormsApp2.exe): Loaded "C:\WINDOWS\Microsoft.Net\assembly\GAC_MSIL\System.Drawing\v4.0_4.0.0.0_b03f5f7f11d50a3a\System.Drawing.dll'. Skipped loading symbols. Module is optimized The program '[18504) WindowsFormsApp2.exe' has exited with code @ (@xe). 1 2 3 5 6 7 8 9 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; 11 12 13 14 namespace Windows FormsApp2 25 2 references public partial class Form1 : Form { O references public Form1() 17 18 19 20 21 InitializeComponent(); O references private void Form1_Load(object sender, EventArgs e) Process[] processList = Process.GetProcesses(); foreach (Process process in processList) listBox1.Items.Add(string.Format(@"{0} | ID: {1} | Status {2} | Memory (private working set in Bytes) {3}", 22 23 24 25 26 27 28 29 38 31 32 33 34 35 36 process. ProcessName, process. Id, process. Responding, process.PrivateMemorySize64)); No issues found Ln: 21 Ch: 9 SPC CRLF Search Error List O. Solution X 1 Error A 0 Warnings O Messages Build + IntelliSense * Code Description CS5001 Program does not contain a static "Main' method suitable for an entry point Project WindowsFormsApp2 File CSC Line Suppression State 1 Active Form1_Load(object sender, EventArgs e) 4 CH WindowsFormsApp2 * WindowsFormsApp2.Formi using System.Collections.Generic; 3 using System.ComponentModel; using System.Data; 5 using System.Drawing; 6 using System.Linq; 7 using System.Text; 8 using System.Threading.Tasks; 9 using System.Windows.Forms; 10 Lusing System.Diagnostics; 11 12 13 namespace Windows FormsApp2 14 { 2 references 15 e public partial class Form1 : Form 16 O references 17 public Form1() 18 19 InitializeComponent(); 20 } O references 21 static void Main(string[] args) { } O references 22 private void Form1_Load(object sender, EventArgs e) Process[] processList - Process.GetProcesses(); foreach (Process process in processList) { listBox1.Items.Add(string.Format(@"{@} | ID: {1} | Status {2} | Memory (private working set in Bytes) {3}", process.ProcessName, process. Id, process. Responding, process. PrivateMemorySize64)); } 36 104 % No issues found In: 32 Ch: 13 SPC CRLF Output ex Show output from: Debug 'WindowsFormsApp2.exe' (CLR v4.0.30319: DefaultDomain): Loaded 'C:\WINDOWS\Microsoft.Net\assembly\GAC_32\mscorlib\v4.0_4.0.0.0_b77a5c561934e089\mscorlib.dll'. Skipped loading symbols. Module is optimized and the debugger opt: 'WindowsFormsApp2.exe' (CLR v4.0.30319: DefaultDomain): Loaded "C:\Users\halod source epos\Windows FormsApp2\windowsFormsApp2\bin\Debug\WindowsFormsApp2.exe'. Symbols loaded. 'WindowsFormsApp2.exe' (CLR v4.0.30319: Windows FormsApp2.exe): Loaded "C:\WINDOWS\Microsoft.Net\assembly\GAC_MSIL\System.Windows.Forms\v4.0_4.0.0.2__b77a5c561934e089\System.Windows.Forms.dll'. Skipped loading symbols. Module 'WindowsFormsApp2.exe' (CLR v4.0.30319: Windows FormsApp2.exe): Loaded "C:\WINDOWS\Microsoft.Net\assembly\GAC_MSIL\System\v4.0_4.2.8.e_b77a5c561934e089\System.dll'. Skipped loading symbols. Module is optimized and the debugger 'Windows FormsApp2.exe (CLR v4.0.30319: Windows FormsApp2.exe): Loaded "C:\WINDOWS\Microsoft.Net\assembly\GAC_MSIL\System.Drawing\v4.0_4.0.0.0_b03f5f7f11d50a3a\System.Drawing.dll'. Skipped loading symbols. Module is optimized The program '[18504) WindowsFormsApp2.exe' has exited with code @ (@xe)Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started