Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / Windows Forms / WinForm General / February 2007

Tip: Looking for answers? Try searching our database.

Form Controls Naming Standards

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Bill Gower - 03 Feb 2007 17:50 GMT
Having come from a VB6 background I liked to prefix all my control names
with txt, cmd, btn etc.  What is the accepted standard for Windows forms
controls.  I have been looking and looking for MS standards and can't find
any.

Bill
RobinS - 04 Feb 2007 02:48 GMT
Here's something you can peruse.

http://dotnet.mvps.org/dotnet/faqs/?id=namingconventions&lang=en

Basically, Hungarian Notation has gone by the wayside, even in Windows
Forms as of the most current version of VS. All the code I've seen from
Microsofties in the past year uses a standard with the name of the control
as a suffix, like LastNameTextBox, FirstNameComboBox, etc. Kind of
long-winded, but there it is. Of course, there's no law saying which way
you have to go.

If you look on MSDN, search for "naming conventions" or "design guidelines"
or something like that, some of the articles for .Net 1.1 still use
Hungarian Notation in the naming of the controls.

So some people still use Hungarian when naming their controls and forms,
some don't.

Definitely don't do it in your classes and internal code, though, like
strLastName. That's definitely not done any more.

Robin S.
Ts'i mahnu uterna ot twan ot geifur hingts uto.
-----------------------------------------------
> Having come from a VB6 background I liked to prefix all my control names
> with txt, cmd, btn etc.  What is the accepted standard for Windows forms
> controls.  I have been looking and looking for MS standards and can't
> find any.
>
> Bill
Herfried K. Wagner [MVP] - 04 Feb 2007 12:27 GMT
"Bill Gower" <billgower@charter.net> schrieb:
> Having come from a VB6 background I liked to prefix all my control names
> with txt, cmd, btn etc.  What is the accepted standard for Windows forms
> controls.  I have been looking and looking for MS standards and can't find
> any.

In addition to the other reply:

Personally I have adopted the convention to choose names like '<type
name><descriptor>' (e.g. 'TextBoxUserName', 'ButtonCancel', ...).  This
allows easy access in IntelliSense.

Signature

M S   Herfried K. Wagner
M V P  <URL:http://dotnet.mvps.org/>
V B   <URL:http://classicvb.org/petition/>


Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.