Reputation: 2198
I am reading a book of HF series on C# and have to do a first simple WinForms app, which contains a button, a checkbox and a label. I created the controls and an event handler for the button with code, didn't make any changes to other files, just the Designer and the file with C# code (don't know how it is called properly).
Saved it all.
When I try to run the program (F5 or Ctrl+F5), VS shows me a default form as if it was blank and without any elements.
What am I doing wrong?
Upvotes: 0
Views: 103
Reputation: 171
If the above solution is not working :
In your program.cs, your probably call Application.Run(new Form()) instead on Application.Run(new Form1())
You instantiate a default form, and not the class you created.
Upvotes: 1
Reputation: 1542
Add the following code inside of Form1.cs:
public Form1()
{
InitializeComponent();
}
Upvotes: 2