Windows controls naming convention

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hi,

Does Microsoft have a listing or a guideline for naming controls in a C# Windows application? i.e. combobox - cbx, dataset - ds

Thanks,
Lynn
 
Actually, they don't recommend Hungarian notation. On forms, I see alot of
things like "OkButton", etc. I thought that there was a doc on this on the
msdn site. I could only seem to be able to dig up right now are some
guidelines for class library developers. I say "only", but there's a lot of
good stuff here (watch for the word-wrap):
http://msdn.microsoft.com/library/d...ef/html/cpconnetframeworkdesignguidelines.asp



Lynn C said:
Hi,

Does Microsoft have a listing or a guideline for naming controls in a C#
Windows application? i.e. combobox - cbx, dataset - ds
 
J.Marsch said:
Actually, they don't recommend Hungarian notation.
On forms, I see alot of things like "OkButton",
etc. I thought that there was a doc on this on the
msdn site.

Well, there is this doc:

http://msdn.microsoft.com/library/d...vbcon98/html/vbconobjectnamingconventions.asp

It applies to VB pre .NET, apparently. I've adapted it for my C#
code. Controls are the only place where I use anything like
Hungarian notation, and I have found it useful to an extent. For
example, instead of fileOpenMenuItem, I would use mnuFileOpen.
However, I do have some doubt about this practice, and I would be
interested in opinions from other C# programmers.
 
Thank you for the links, but I've already visited both locations. I wanted to locate a listing specific to C# Windows object if such a list exist or has been release by Microsoft.
 
Well, the listing on the VB page is a Microsoft list, but the point is that
there isn't a list any more because you're not supposed to use Hungarian
now.

All the Best
Julian N.

Lynn C said:
Thank you for the links, but I've already visited both locations. I wanted
to locate a listing specific to C# Windows object if such a list exist or
has been release by Microsoft.
 
I had a very strong habit of doing that when I started with C# (from my days
with Delphi). I've been trying to "cross over" and start using the
<nameofthe thing>ControlClassName pattern: OkButton, as this is the coding
standard where I work. However, for controls, I'm finding that I like it
better when the typename comes first (as with hungarian notation). Reason:
if you pull up intellisense with this., you see all of the controls on the
form sorted by type. I kind of like that organization.

As it is, I'm sticking to our standard, even though I like hungarian names
for the controls. Because, as Red Foreman once said: "If we didn't have
laws, we'd all still be living in trees, throwing our feces at each other.".
<g>
 
Hello,

This KB artilce may be helpful to you. It gives you the naming conventions used by Microsoft Consulting Services (MCS).

"INFO: Microsoft Consulting Services Naming Conventions for Visual Basic"
http://support.microsoft.com/?id=110264

Here is another useful link that I got:
http://www.akadia.com/services/naming_conventions.html

Hope that helps.

Best regards,
Yanhong Huang
Microsoft Community Support

Get Secure! ¨C www.microsoft.com/security
This posting is provided "AS IS" with no warranties, and confers no rights.
 
Back
Top