Reputation: 373
I'm having trouble finding a site that goes into detail about naming conventions for the common controls of Visual Studio. Either a website or list would be appreciated.
I'm not looking for naming conventions for namespaces, classes, methods, or variables. I am looking for naming conventions for things like buttons and labels.
Upvotes: 0
Views: 4922
Reputation: 4991
Not quite sure if there is an actuall standard, as lots of developers like to argue pro's and cons on humpback and other notations.
I just finished up my program at fanshawe, and throughout the years they have recommended using hungarian notation.
That being said, here is some exmaples of how we were taught;
lblName - label
txtName - text box
cmbName - combo box
drpName = drop down
Really, you want to associaite the variable name with what the variable actually is.
http://en.wikipedia.org/wiki/Hungarian_notation
Upvotes: 1
Reputation: 9891
Best practices for C# GUI naming conventions?
It seems that this is still something of a theological war with no accepted convention in the wider community.
Upvotes: 3
Reputation: 41266
I typically use a rather simple convention:
_buttonSubmit (ASP:Button Called Submit)
_dropDownYear (ASP:DropDownList for Years)
_placeHolderSomething (ASP:PlaceHolder for something)
Now, winForms, WPF, or ASP.NET, I think it's a good idea to always prefix your name with the control type, so when using it in a code behind, you instantly know what it is.
_radioButtonOne
Without mousing over for intellisense, you can be sure it's a Radio Button, etc. In addition, the '_' in front usually separates it from local variables as an instance specific member.
_radioButtonOne.Checked = true;
someLocalVariable++;
Upvotes: 1