I want to make a button run some code, then press itself again in Windows Forms.
When I call the button itself I get the error:
System.StackOverflowException
HResult=0x800703E9
Source=<Cannot evaluate the exception source>
StackTrace:
<Cannot evaluate the exception stack trace>
I want to make a resource monitor program to get myself familiarized with C#. Right now I'm stuck at the string processing and displaying a constantly changing string. I'm using a randomly generated number as a placeholder, that I want to show and change permanently, imitating real data pulling.
The code I have:
public void Start_Click(object sender, EventArgs e){
var usage =new CpuUsage(); //placeholder class for getting the CPU use data
usage.setCPU(); //gets a random number
this.CPU.Text = usage.cpuUsage; //show the usage data on a textbox
Start_Click(null, EventArgs.Empty); //call this button again here
}
What I want to get look something like:
- Get data
- Show data using text box
- Redo this