I've created quite a few user controls to encapsulate GUI functionality used in multiple places in my app. I've noticed I usually have a tendency to describe the function of the control and tack "Control" on the end of the name, but not always. I'd like to standardize the naming and wanted to know if there's a best practice for naming User Controls in .NET?
For example, a button, when dropped to a form, gets the typename + number, camel-cased as default name, such as "button1".
Use the following naming conventions for field names: All fields must be lower case. Use snake case (underscores) for combining words. Group related fields into subdocuments by using dot (.)
Complete first name plus last name: This is by far the most commonly used naming convention I found other people using. You take the users complete first name and combine it with the complete last name. A hyphen or period may also be added. Example: For Joe smith the logon name would be joe.
Actually, Control is a pretty good suffix. Consider making a control for Name/Address, you want something in the name that marks it as GUI instead of Logical.
So I tend to use NameAddressControl.
I also suffix my user controls with "Control"
My typical structure for UI modules would look something like:
DataEntry
-> DataEntryForm
-> DataEntryAddressControl
-> DataEntryNameControl
-> DataEntryAddressItem
-> DataEntryAddressItemCollection
-> DataEntryConfirmationDialog
etc.
works well for our team
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With