473,382 Members | 1,386 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,382 software developers and data experts.

Naming convention of controls

Greetings,

I am in the process of creating naming conventions for VB.NET controls i.e.

CheckBox -> chkShowThisOnStartup
ListBoxt -> lstSomeList
What I am looking for other developers input for Window.Form controls and
what they are using for naming controls.

Note: On MSDN I have found a good deal on standards for non-visuals but not
controls.

Thanks,
Kevin

Nov 23 '05 #1
9 3786
Everything should be in here:
http://msdn.microsoft.com/library/de...guidelines.asp

showThisOnStartupCheckBox
someListListBox

Gabriel Lozano-Morán
Nov 23 '05 #2
The debate rages on... but anything that is private to your class can be
named in any way that you like. Hungarian notation is discouraged, and the
VB style control naming syntax is a variation of that. However, if your
controls are publicly visible or accessible from derived classes then they
should follow Pascal casing, since they are treated as public fields.
http://msdn.microsoft.com/library/de...guidelines.asp

If you're controls are being classified as "private", then I still find
myself using the good ol' VB naming style (Label = lbl, Button = btn, etc.).
And for those instances where there may be no corresponding VB control I
would just guess based on past VB experience.

--
Tim Wilson
..NET Compact Framework MVP

"ke*************@state.or.us" <Ke***************@state.or.us> wrote in
message news:OO**************@TK2MSFTNGP11.phx.gbl...
Greetings,

I am in the process of creating naming conventions for VB.NET controls i.e.
CheckBox -> chkShowThisOnStartup
ListBoxt -> lstSomeList
What I am looking for other developers input for Window.Form controls and
what they are using for naming controls.

Note: On MSDN I have found a good deal on standards for non-visuals but not controls.

Thanks,
Kevin

Nov 23 '05 #3
I think you should not use your own naming conventions either for public or
private methods unless you have a very good reason to do so.
Naming conventions are well documented and you should get used to them
regardless of the scope of your procedures or controls.
I find somewhat difficult having two naming conventions to remember.

--
António
"ke*************@state.or.us" wrote:
Greetings,

I am in the process of creating naming conventions for VB.NET controls i.e.

CheckBox -> chkShowThisOnStartup
ListBoxt -> lstSomeList
What I am looking for other developers input for Window.Form controls and
what they are using for naming controls.

Note: On MSDN I have found a good deal on standards for non-visuals but not
controls.

Thanks,
Kevin

Nov 23 '05 #4
"Tim Wilson" <TIM(UNDERSCORE)WILSON(AT)ROGERS(PERIOD)COM> wrote in message
news:et**************@TK2MSFTNGP14.phx.gbl...
The debate rages on... but anything that is private to your class can be
named in any way that you like. Hungarian notation is discouraged, and the
VB style control naming syntax is a variation of that. However, if your
controls are publicly visible or accessible from derived classes then they
should follow Pascal casing, since they are treated as public fields.
http://msdn.microsoft.com/library/de...guidelines.asp

If you're controls are being classified as "private", then I still find
myself using the good ol' VB naming style (Label = lbl, Button = btn,
etc.).
And for those instances where there may be no corresponding VB control I
would just guess based on past VB experience.

--
Tim Wilson
.NET Compact Framework MVP


Except for Button = btn.... VB naming conventions say to use cmd for the
first 3 letters of a button's name.

Visual Basic Coding Conventions
http://msdn.microsoft.com/library/de...asp?frame=true

....more specifically,...

Object Naming Conventions
http://msdn.microsoft.com/library/de...onventions.asp

Not sure where "btn" was born.... probably some web dev. We use a very
slightly modified version of the doc(s) above. Since we don't use any of the
controls where a 4 or 5 letter prefix is defined (5 letter prefix? sheesh
<g>), we've removed those from our version of the docs.

--
Ken Halter - MS-MVP-VB (visiting from VB6 world) - http://www.vbsight.com
Please keep all discussions in the groups..
Nov 23 '05 #5
Yeah, I think that "btn" seeped into my programming culture over the years.
Probably because it seems to make more sense with the naming of the .NET
"Button" control.

--
Tim Wilson
..NET Compact Framework MVP

"Ken Halter" <Ken_Halter@Use_Sparingly_Hotmail.com> wrote in message
news:uA**************@TK2MSFTNGP10.phx.gbl...
"Tim Wilson" <TIM(UNDERSCORE)WILSON(AT)ROGERS(PERIOD)COM> wrote in message
news:et**************@TK2MSFTNGP14.phx.gbl...
The debate rages on... but anything that is private to your class can be
named in any way that you like. Hungarian notation is discouraged, and the VB style control naming syntax is a variation of that. However, if your
controls are publicly visible or accessible from derived classes then they should follow Pascal casing, since they are treated as public fields.
http://msdn.microsoft.com/library/de...guidelines.asp
If you're controls are being classified as "private", then I still find
myself using the good ol' VB naming style (Label = lbl, Button = btn,
etc.).
And for those instances where there may be no corresponding VB control I
would just guess based on past VB experience.

--
Tim Wilson
.NET Compact Framework MVP
Except for Button = btn.... VB naming conventions say to use cmd for the
first 3 letters of a button's name.

Visual Basic Coding Conventions

http://msdn.microsoft.com/library/de...asp?frame=true
...more specifically,...

Object Naming Conventions
http://msdn.microsoft.com/library/de...onventions.asp
Not sure where "btn" was born.... probably some web dev. We use a very
slightly modified version of the doc(s) above. Since we don't use any of the controls where a 4 or 5 letter prefix is defined (5 letter prefix? sheesh
<g>), we've removed those from our version of the docs.

--
Ken Halter - MS-MVP-VB (visiting from VB6 world) - http://www.vbsight.com
Please keep all discussions in the groups..

Nov 23 '05 #6
My vote is PLEASE loose the btn, chk, ect. and adopt a modern standard
where-in you just post fix with the control type.

CheckBox -> myCheckBox
ListBoxt -> myListBox

The only thing I don't like about this naming conventison is that in
order to wire it up in the code behind, there is a protected member
variable. I don't know about you all, but I prefix all my member
varaibles with _myVariable (no, not m_MyVariable, but this is just a
style preference) so, I may argue in this case you should add the _ to
your control names so the member varaible naming convention is not
violated.

CheckBox -> _myCheckBox
ListBoxt -> _myListBox

What are everyone's thoghts on that?

Nov 23 '05 #7
Again, it just comes down to preference, or whatever standard the business
that you work for has decided upon. Microsoft does not put forth standards
for code that is private. I know that standards are a good thing but what is
"good" depends on who you ask. So unless the business that I work for
mandates a private naming policy (which very well could be the case), I
would just do whatever makes my life easier in the long run. I work
primarily in C# and by default the controls are marked private.

--
Tim Wilson
..NET Compact Framework MVP

<mi************@gmail.com> wrote in message
news:11*********************@z14g2000cwz.googlegro ups.com...
My vote is PLEASE loose the btn, chk, ect. and adopt a modern standard
where-in you just post fix with the control type.

CheckBox -> myCheckBox
ListBoxt -> myListBox

The only thing I don't like about this naming conventison is that in
order to wire it up in the code behind, there is a protected member
variable. I don't know about you all, but I prefix all my member
varaibles with _myVariable (no, not m_MyVariable, but this is just a
style preference) so, I may argue in this case you should add the _ to
your control names so the member varaible naming convention is not
violated.

CheckBox -> _myCheckBox
ListBoxt -> _myListBox

What are everyone's thoghts on that?

Nov 23 '05 #8
I disagree with that a bit. I learned a standard with a company I was
employed with years ago, and modified it slightly for my own taste.
I now use that "standard" in all my personal code. However, at my current
job, we have several different areas to service and a multitude of
languages,
using software previously written by other companies and modified by other
support personnel...
So I end up using whatever standards have been used previously for similar
code.
Actually, I looked up the "standard notation/conventions" listed in our
company specs, and found them to be last updated in 1990...

I hate trying to decipher other peoples notation (especially when variables
are named a, b, c, d etc!!), but I haven't got time to rewrite the entire
thing to any standard... so it has to remain a bit of a mess.. :(

Just my tuppence
____________________________________________
The Grim Reaper

"António Pinho" <An*********@discussions.microsoft.com> wrote in message
news:33**********************************@microsof t.com...
I think you should not use your own naming conventions either for public or
private methods unless you have a very good reason to do so.
Naming conventions are well documented and you should get used to them
regardless of the scope of your procedures or controls.
I find somewhat difficult having two naming conventions to remember.

--
António
"ke*************@state.or.us" wrote:
Greetings,

I am in the process of creating naming conventions for VB.NET controls
i.e.

CheckBox -> chkShowThisOnStartup
ListBoxt -> lstSomeList
What I am looking for other developers input for Window.Form controls and
what they are using for naming controls.

Note: On MSDN I have found a good deal on standards for non-visuals but
not
controls.

Thanks,
Kevin

Nov 23 '05 #9
Thanks for all the replies and insight into this matter, much appriciated!
Nov 23 '05 #10

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Lalit | last post by:
Hi Friends, We are defining coding standards for our company. In MSDN i have seen that hungarian notation will not be used in naming of variables etc. What about the controls ? Should we...
27
by: Derek | last post by:
The company where I work uses a naming convention that I have never used before. They use mixed-case letters for public member functions, but lower-case with underscores for the rest, like this:...
4
by: Mark Broadbent | last post by:
stupid question time again to most of you experts but this is something that continually bothers me. I am trying to get into the habit of naming variables and controls in an assembly as per...
14
by: 42 | last post by:
Hi, Stupid question: I keep bumping into the desire to create classes and properties with the same name and the current favored naming conventions aren't automatically differentiating them......
0
by: Carl Colijn | last post by:
Hi all, Disclaimer: before I might trigger your "let's start a holy war!" button, I'd like to say I'm not intended to; I just post this message to get some input and not to promote "Yet Another...
6
by: dm1608 | last post by:
I'm relatively new to ASP.NET 2.0 and am struggling with trying to find the best naming convention for the BAL and DAL objects within my database. Does anyone have any recommendations or best...
4
by: Sturdy | last post by:
Hi, I'm new to C# and .NET. I'm a first time user of Visual C# 2005 Express and have a very basic question. I've looked at several links and lots of docs but can't find any tips on naming multiple...
114
by: Jonathan Wood | last post by:
I was just wondering what naming convention most of you use for class variables. Underscore, "m_" prefix, camel case, capitalized, etc? Has one style emerged as the most popular? Thanks for...
35
by: Smithers | last post by:
Is it common practise to begin the name of form classes with "frm" (e.g., frmOneForm, frmAnotherForm). Or is that generally considered an outdated convention? If not "frm" what is a common or...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.