Connecting Tech Pros Worldwide Help | Site Map

Windows controls naming convention

 
LinkBack Thread Tools Search this Thread
  #1  
Old November 16th, 2005, 05:24 AM
Lynn C
Guest
 
Posts: n/a
Default Windows controls naming convention

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

  #2  
Old November 16th, 2005, 05:25 AM
J.Marsch
Guest
 
Posts: n/a
Default 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/de...guidelines.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]


  #3  
Old November 16th, 2005, 05:25 AM
Wavemaker
Guest
 
Posts: n/a
Default 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/de...onventions.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.


  #4  
Old November 16th, 2005, 05:31 AM
Lynn C
Guest
 
Posts: n/a
Default 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/de...onventions.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]
  #5  
Old November 16th, 2005, 05:31 AM
Julian Nicholls
Guest
 
Posts: n/a
Default 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]


  #6  
Old November 16th, 2005, 05:32 AM
J.Marsch
Guest
 
Posts: n/a
Default 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/de...onventions.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]


  #7  
Old November 16th, 2005, 05:35 AM
Yan-Hong Huang[MSFT]
Guest
 
Posts: n/a
Default 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.

 

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Popular Articles

What is Bytes?

We are a network of experts and professionals in IT and software development that help one another with answers to tough questions and share insights. Get the best answers to your questions from over 220,662 network members.