|
-
Apr 25th, 2002, 11:06 PM
#1
Thread Starter
Member
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
-
Apr 26th, 2002, 08:55 AM
#2
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
-
Apr 26th, 2002, 02:30 PM
#3
Thread Starter
Member
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
-
May 14th, 2002, 02:39 PM
#4
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.
-
May 15th, 2002, 01:12 AM
#5
Thread Starter
Member
Thanks! That is exactly what I was looking for.
-
Jul 8th, 2002, 03:49 PM
#6
Addicted Member
Last edited by GSIV; Jul 8th, 2002 at 10:31 PM.
-
Jul 8th, 2002, 04:02 PM
#7
Thanks GSIV for this early notification.
-
Jul 8th, 2002, 04:20 PM
#8
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
-
Jul 8th, 2002, 10:32 PM
#9
Addicted Member
Frans, Frans, Frans...
-
Jul 8th, 2002, 10:51 PM
#10
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:
Public FirstName As String ' Global variable or public field in a class
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
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|