|
|
|
Here's a little programming tip that will save you hours of headaches later.
Most of us already indent our Ifs, Selects, Do...Loops, etc., and that is good. But suppose you have some fairly complex code with several levels of indentation. Example: |
It does get a little confusing as to which End If goes with which If, etc, because the original statement has scrolled up off the screen. My suggestion is this: modify your programming style slightly so that you create your If - End If or Do - Loop statements together and comment the End or Loop statement with the conditional clause. Example: If A= 0 And B=1 Then ' ... End If ' A= 0 and B=1
Now put your cursor in the blank line and continue programming. Do this for every pair and you will wind up with our example above looking like this: |
Of course you can use the same approach with other VB code blocks, such as For-Next loops and Select Case clauses. Our code is now much easier to maintain. You will be quite happy you did this when you re-visit the code in six months, and believe me, the person who takes your place when you leave will bless you in their prayers at night!
|
|
|
|
Submitted By :
Nayan Patel
(Member Since : 5/26/2004 12:23:06 PM)
|
|
|
Job Description :
He is the moderator of this site and currently working as an independent consultant. He works with VB.net/ASP.net, SQL Server and other MS technologies. He is MCSD.net, MCDBA and MCSE. In his free time he likes to watch funny movies and doing oil painting. |
View all (893) submissions by this author
(Birth Date : 7/14/1981 ) |
|
|