This question already has an answer here:
- textBoxEmployeeName vs employeeNameTextBox 16 answers
Microsoft has naming guidelines on their website (here). Also I have the Framework Design Guidelines book.
What I could not find was a guideline about naming controls.
For example, a button, when dropped to a form, gets the typename + number, camel-cased as default name, such as "button1".
This is what I do: I delete the number and add a meaningful description after. For example "buttonDelete" or "buttonSave".
This way you do not have to maintain a big list of controls and their abbreviated names in a guideline somewhere.
Do you agree?
I don't have a convention as such, but I do try to be very broad with the 'type' portion of the name. e.g. Button, Link Button, Image Button tend to be named 'somethingButton'. Combo boxes, radio button lists all end up as 'somethingSelector'. TextBoxes and Calendars are 'somethingInput'. That way I get a rough idea of what sort of control it is without the name being tied to the actual implementation. If I decide to replace an option button group with a dropdown then no need to rename!
Yes, I agree totally (but I rename it to ButtonDelete), so lowercase names are for variables in my case :)
Personally, I think as long as you are consistent, you won't run into problems even if someone else is reading your code.
GUI programming gets the short stick when it comes to conventions of all sorts. See my answer to another question for the guidelines I use for naming.
I'm probably one of the last few people that still uses Hungarian notation. I know that argument that the IDE can tell you the variable type, but that doesn't help me when I'm coding in Notepad++ or looking at a printout.... anyway, I use the "btnSave", "cbOptions", "txtFirstName", "lblTitle", "ddlCardType", etc... I just like being able to glance at code and know what I'm looking at without looking for a declaration or hovering over a variable to get it's data type from the IDE.
Here are some common ones:
A longer list is at INFO: Object Hungarian Notation Naming Conventions for VB.
Yes change those names
For me:
Button btnDescription
TextBox txtDescription
ComboBox cboDescription
etc...