When you create a Windows form project (A Gui one), it has a main loop - in fact, it requires one. By default, it is in program.cs and it launches your form:
static class Program {
Perhaps you need a form constructor. This is in the code behind the form (by default Form1.cs) and will look like this:
public partial class Form1 : Form { public Form1() { InitializeComponent(); } }
source share