Results 1 to 10 of 10

Thread: Recommended Naming Conventions

  1. #1

    Thread Starter
    Member
    Join Date
    Mar 2002
    Posts
    40

    Question Recommended Naming Conventions

    Is there a list of recommended naming conventions in the VS.NET help like there is in the MSDN Help for VB 6? I'm referring to the sections that tell you to use txt for a TextBox, gint for a global integer, etc. When I do a search for "naming conventions" in VS.NET I only find stuff about things like System.Drawing.Color, System.Windows.Forms.PictureBox, etc.

    Thanks in advance! Lance

  2. #2
    Thelonius
    Guest
    I just use the same ones I did in VB6. The only real exception to the old naming conventions is using an underscore & property name for Private variables in a class.

    Public Class myClass

    Private _myProperty as string

    Public Property myProperty () as String
    ....

    End Property

  3. #3

    Thread Starter
    Member
    Join Date
    Mar 2002
    Posts
    40
    Thanks for the info. I've also been using the old naming conventions when possible, but I get stuck whenever I use a new control. For example, what prefixes should I use for PrintDialog, PrintPreviewDialog, PrintPreviewControl, and PrintDocument controls? Things could get confusing in a hurry if we aren't all using the same prefixes

    Thanks again. Lance

  4. #4
    old fart Frans C's Avatar
    Join Date
    Oct 1999
    Location
    the Netherlands
    Posts
    2,926
    Have a look at
    ms-help://MS.VSCC/MS.MSDNVS/vsent7/html/vxconcodingtechniquesprogrammingpractices.htm
    and at
    ms-help://MS.VSCC/MS.MSDNVS/vbcn7/html/vaconvbnamingrules.htm
    in VS.NET help for new coding techniques and naming conventions. There seems to be a complete new approach to naming conventions.
    Last edited by Frans C; May 14th, 2002 at 02:44 PM.

  5. #5

    Thread Starter
    Member
    Join Date
    Mar 2002
    Posts
    40
    Thanks! That is exactly what I was looking for.

  6. #6
    Addicted Member GSIV's Avatar
    Join Date
    Jun 2002
    Location
    Texas, USA
    Posts
    213

    Update

    Web page >address< has been updated:

    http://support.microsoft.com/default...;EN-US;q110264
    Last edited by GSIV; Jul 8th, 2002 at 10:31 PM.

  7. #7
    old fart Frans C's Avatar
    Join Date
    Oct 1999
    Location
    the Netherlands
    Posts
    2,926
    Thanks GSIV for this early notification.

  8. #8
    l33t! MrPolite's Avatar
    Join Date
    Sep 2001
    Posts
    4,428
    camel case and pascal case stufff.......
    for private stuff: either type it all in lower case or type the FIRST character in lowercase. like:
    private sub formatComputer ()

    for public stuff type the first character in upper case:
    Public sub ExplodeUniverse ()


    and do not use something like "strText" because you can easily find the type of it if you move the mouse over it. just use something like "text" when defining variables... there is a page in my bookie about naming stuff.... I might type it up when I get bored

  9. #9
    Addicted Member GSIV's Avatar
    Join Date
    Jun 2002
    Location
    Texas, USA
    Posts
    213
    Frans, Frans, Frans...

  10. #10
    l33t! MrPolite's Avatar
    Join Date
    Sep 2001
    Posts
    4,428
    This is from the book Programming Microsoft Visual Basic .NET (Core Reference). Hope it will help, I found it very useful:

    • Don’t use so-called Hungarian notation for variables and parameters. Visual Studio .NET lets you browse the declaration of a variable by simply moving the mouse cursor over it, so you don’t need a prefix to make the variable’s type explicit, as in lngValue.
    • Parameters are lowercase or camelCase-for example, firstName or currentValue
    • Private variables should be camelCase, whereas public fields in classes that appears as properties to clients should be PascalCase. This leads to weird situations as in this code:
    VB Code:
    1. Public FirstName As String  ' Global variable or public field in a class
    2.  
    3. Dim lastName As String      'Private variable




    HTH

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width