Login or Sign up Help | Site Map
Connecting Tech Pros Worldwide

Windows controls naming convention

Question posted by: Lynn C (Guest) on November 16th, 2005 05:24 AM
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
Would you like to answer this question?
Sign up for a free account, or Login (if you're already a member).
J.Marsch's Avatar
J.Marsch
Guest
n/a Posts
November 16th, 2005
05:25 AM
#2

Re: Windows controls naming convention
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...nguidelines.asp



"Lynn C" <lynnc@newsgroups.nospam> wrote in message
news:5965BDF5-2446-436C-9B74-951FAE215896@microsoft.com...[color=blue]
> Hi,
>
> Does Microsoft have a listing or a guideline for naming controls in a C#[/color]
Windows application? i.e. combobox - cbx, dataset - ds[color=blue]
>
> Thanks,
> Lynn[/color]



Wavemaker's Avatar
Wavemaker
Guest
n/a Posts
November 16th, 2005
05:25 AM
#3

Re: Windows controls naming convention

"J.Marsch" wrote:[color=blue]
> 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.[/color]

Well, there is this doc:

http://msdn.microsoft.com/library/d...conventions.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.



Lynn C's Avatar
Lynn C
Guest
n/a Posts
November 16th, 2005
05:31 AM
#4

Re: Windows controls naming convention
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.

"Wavemaker" wrote:
[color=blue]
>
> "J.Marsch" wrote:[color=green]
> > 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.[/color]
>
> Well, there is this doc:
>
> http://msdn.microsoft.com/library/d...conventions.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.
>
>
>[/color]

Julian Nicholls's Avatar
Julian Nicholls
Guest
n/a Posts
November 16th, 2005
05:31 AM
#5

Re: Windows controls naming convention
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" <lynnc@newsgroups.nospam> wrote in message
news:6E813D81-B010-4714-8BD3-CC4EBC50FE80@microsoft.com...[color=blue]
> Thank you for the links, but I've already visited both locations. I wanted[/color]
to locate a listing specific to C# Windows object if such a list exist or
has been release by Microsoft.[color=blue]
>[/color]



J.Marsch's Avatar
J.Marsch
Guest
n/a Posts
November 16th, 2005
05:32 AM
#6

Re: Windows controls naming convention
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>

"Wavemaker" <jabberdabber@BiteMeHotmail.com> wrote in message
news:3b6dnXuC55jLB07dRVn-iQ@comcast.com...[color=blue]
>
> "J.Marsch" wrote:[color=green]
> > 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.[/color]
>
> Well, there is this doc:
>
>[/color]
http://msdn.microsoft.com/library/d...conventions.asp[color=blue]
>
> 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.
>
>[/color]



Yan-Hong Huang[MSFT]'s Avatar
Yan-Hong Huang[MSFT]
Guest
n/a Posts
November 16th, 2005
05:35 AM
#7

Re: Windows controls naming convention
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.


 
Not the answer you were looking for? Post your question . . .
178,098 Experts ready to help you find a solution.
Sign up for a free account, or Login (if you're already a member).

  • Didn't find the answer you were looking for?
    Post Your Question
  • Top Community Contributors