How do you name controls?
-
-
I prefer to 'Hungarian Notation' than 'PascalCase' to named controls. e.g. I like use btnOk, btnCancel, txtName, txtAge but not okButton, cancelButton, nameTextBox, ageTextBox. which one do you like? and why?
Glad to discuss with you and best wishes.
The former, but only with controls. When I need to store the user's name in a string, it's always userName, never strUserName.
Cheers, Vıkram.
I've never ever worked anywhere where there has not been someone who given the choice I would not work with again. It's a job, you do your work, put up with the people you don't like, accept there are probably people there that don't like you a lot, and look forward to the weekends. - Josh Gray.
-
The former, but only with controls. When I need to store the user's name in a string, it's always userName, never strUserName.
Cheers, Vıkram.
I've never ever worked anywhere where there has not been someone who given the choice I would not work with again. It's a job, you do your work, put up with the people you don't like, accept there are probably people there that don't like you a lot, and look forward to the weekends. - Josh Gray.
-
I prefer to 'Hungarian Notation' than 'PascalCase' to named controls. e.g. I like use btnOk, btnCancel, txtName, txtAge but not okButton, cancelButton, nameTextBox, ageTextBox. which one do you like? and why?
Glad to discuss with you and best wishes.
The actual class: MyTextBox The class instance: myTextBox Its properties and events: Text ... TextChanged Why, to follow the convention that is used almost everywhere, and so I can see instantly if I'm working with an instance or a static
Dave
BTW, in software, hope and pray is not a viable strategy. (Luc Pattyn)
Visual Basic is not used by normal people so we're not covering it here. (Uncyclopedia) -
I prefer to 'Hungarian Notation' than 'PascalCase' to named controls. e.g. I like use btnOk, btnCancel, txtName, txtAge but not okButton, cancelButton, nameTextBox, ageTextBox. which one do you like? and why?
Glad to discuss with you and best wishes.
I use
buttonOK
,checkboxCheckMe
, etc. That way, all controls of the same type are grouped in the same place in intellisense. You could take it a step further and maybe usectlButtonOK
, andctlCheckboxCheckMe
, and that would put *all* of the controls in one single group in intellisense, yet still separate the controls by type within the group."Why don't you tie a kerosene-soaked rag around your ankles so the ants won't climb up and eat your candy ass..." - Dale Earnhardt, 1997
-----
"...the staggering layers of obscenity in your statement make it a work of art on so many levels." - Jason Jystad, 10/26/2001 -
I use
buttonOK
,checkboxCheckMe
, etc. That way, all controls of the same type are grouped in the same place in intellisense. You could take it a step further and maybe usectlButtonOK
, andctlCheckboxCheckMe
, and that would put *all* of the controls in one single group in intellisense, yet still separate the controls by type within the group."Why don't you tie a kerosene-soaked rag around your ankles so the ants won't climb up and eat your candy ass..." - Dale Earnhardt, 1997
-----
"...the staggering layers of obscenity in your statement make it a work of art on so many levels." - Jason Jystad, 10/26/2001