Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

Is my understanding of code generation in WinForm apps correct?

BobLewistonBobLewiston Member Posts: 43
Is my understanding of code generation in WinForm apps correct?

When you create a program that features a single Windows Form using Visual C#'s Windows Form Designer, three source files are created:

1. program.cs, which:
.....a. does some preliminary configuration of the form and then launches it, and <-- couldn't configuration be done transparently upon launching?
.....b. all the user-written, non-form-related stuff.

2. form1.cs, whose generated code contains that part of the form's class that is to be editted by the user, including "empty" methods:
.....a. the constructor, which calls InitializeComponent, which initializes the form, and
.....b. various user-written, event-driven methods, which:
..........1. handle "operation" of the form, and
..........2. call Application.Exit, which terminates execution of the form.

3. form1.designer.cs, whose generated code contains that part of the form's class that is NOT to be editted by the user:
.....a. the Windows Form Designer generated method InitializeComponent, and
.....b. the method Dispose, which disposes of the form. <-- can't this be editted?

Sign In or Register to comment.