473,695 Members | 2,372 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Naming convention of controls

Greetings,

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

CheckBox -> chkShowThisOnSt artup
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 3807
Everything should be in here:
http://msdn.microsoft.com/library/de...guidelines.asp

showThisOnStart upCheckBox
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******** ******@TK2MSFTN GP11.phx.gbl...
Greetings,

I am in the process of creating naming conventions for VB.NET controls i.e.
CheckBox -> chkShowThisOnSt artup
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 -> chkShowThisOnSt artup
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)ROGE RS(PERIOD)COM> wrote in message
news:et******** ******@TK2MSFTN GP14.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_Hotm ail.com> wrote in message
news:uA******** ******@TK2MSFTN GP10.phx.gbl...
"Tim Wilson" <TIM(UNDERSCORE )WILSON(AT)ROGE RS(PERIOD)COM> wrote in message
news:et******** ******@TK2MSFTN GP14.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******** *************@z 14g2000cwz.goog legroups.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*********@di scussions.micro soft.com> wrote in message
news:33******** *************** ***********@mic rosoft.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 -> chkShowThisOnSt artup
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
312
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 eliminate prefixes from these also. What do u suggest? Thanks in Advance
27
6711
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: class Foo { public: void somePublicMemberFunction(); protected:
4
7145
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 convensions. The thing is that Ive never really get the full reference to check against. Ive seen a couple of articles, but there always seems to be a bit missing. I also always seem to run into conflicting convensions both in code samples themselves...
14
3131
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... (both are "Pascal Case" with no leading or trailing qualifiers). For example... I'll be modelling something, e.g. a computer, and I'll
0
1743
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 Naming Convention". It's a bit of a long post, but I've spent the past few days on perfecting this, finally came to the conclusion that maybe I went a bit overboard with it, almost willing to just say "the @#$ with it" but I didn't want to let it...
6
4070
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 practices for naming my objects? I currently have all my type classses simply called "JobSummaryClass" or "JobDetailsClass". These classes simply contain the public properties and the get/set functions for the object. Is this an appropriate naming...
4
1778
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 controls used for the same purpose on different Forms. Specifically, I have several identical TextBox controls each on a different TabPage. The textboxes display the same variable content on each TabPage. An example might be display of name...
114
7840
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 any comments. --
35
12184
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 recommended practise? Thanks.
0
8572
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
9115
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8984
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8847
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8825
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7661
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6491
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
4340
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4579
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?

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.