Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Naming convention in VB

Status
Not open for further replies.

MaxEd

Technical User
Jul 3, 2002
407
0
0
US
Hi,

This is my first post. My friend introduced me to this website and I found plenty of great information. Ok here's my question. I have recently started doing some programming in VBA and I sort of lost my ways in the naming convention used on variables. Could someone enlighten me on the naming conventions that programmers are using these days? thank you!

Ed

[thumbsup]
 
In VB, the convention is to use a letter for the scope, the an abbreviated data type as a prefix, and a mixed case name.

For example,
Code:
 ' Global variables
 Public glngSuperCount as Long
 
 ' Procedure scope variables
 Dim pintCounter as Integer
 Dim pdlbValue as Double
 Dim pstrLastName as String

That said, omit almost all prefixes and use a mixed case name.
 
Do you mean declaring variables?
As in:

Dim thename As String
Dim lastrow As Long

thisvar As Global

Public lastrow As Long

 
ratman,

I have no problem declaring variables but I would like to learn how to give them proper names to indicate what the type of string they are. I have read books where they tell you to call your variables "myInput" and such. Thanks for your input though.

segmentationdefault,
That answers my question. Thank you!
 
Hi & welcome!
This isn't exactly what you're looking for but it may be useful in connection with what you're looking for (if that makes sense?)

Anyway

I've never gone as far as using p & g for procedure & global but I like the idea of "pintCounter"

Happy Friday
;-) If a man says something and there are no women there to hear him, is he still wrong?
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top