Here is my code below
using System.Diagnostics;
while (Process.GetProcessesByName("Your Program").Length == 0);
{
if (Checkbox.Checked)
{
form2.Visible = true;
}
else
{
form2.Visible = false;
}
}
My problem is when "Your Program" is not open and the checkbox is checked it does not check and causes the application to freeze. I want the program to be able to check/uncheck regardless but only open the second form when the program is running.
Another problem I had was when "Your Program" was closed the form would still show which caused more issues like trying to uncheck the checkbox but ultimately leading to more freezing of the program until I had to kill it.