Form Designer generates only fields for controls.
Form1.Designer.cs:
...
private Button closeButton;
...
Disadvantages:
- if I want to make closeButton protected or public I need to manually
write property(because making field protected or public is not
recommended)
- event handlers for controls does not follow method naming convention
(should use Pascal Casing)
Ex: private void closeButton_Click(object sender, EventArgs e)
- ....
As for me I expect Form Designer to generate something like this:
...
private Button closeButton;
private Button CloseButton
{
get { return closeButton }
}
...
Why not?
> - if I want to make closeButton protected or public I need to manually
> write property(because making field protected or public is not
> recommended)
Making a Control protected or public by default is a bad idea. The Control
is generally only used by the Form itself. Properties are used to expose
members to other classes. The members are made private fields by default
because that is the most likely and safest thing to do when writing your
code for you. Anything else is poor use of encapsulation.
> - event handlers for controls does not follow method naming convention
> (should use Pascal Casing)
> Ex: private void closeButton_Click(object sender, EventArgs e)
> - ....
An Event Handler is not specifically a Method. It is used as a delegate. As
for how it *should* be cased, that is purely arbitrary. Microsoft has
long-established conventions for code that are employed across the board in
uniform fashion across the enterprise. You may find the following section of
the MSDN Library useful:
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpgenref/html/c
pconnetframeworkdesignguidelines.asp

Signature
HTH,
Kevin Spencer
Microsoft MVP
Professional Numbskull
Show me your certification without works,
and I'll show my certification
*by* my works.
> Form Designer generates only fields for controls.
>
[quoted text clipped - 23 lines]
>
> Why not?
tomj@softhome.net - 30 Mar 2006 10:31 GMT
>Making a Control protected or public by default is a bad idea.
And what about forms inheritance?
Some controls in base form should be protected.
What you propose to do?