Author:
• Sunday, January 15th, 2012

Think about you are writing a program in Visual Primary, and also you wish to create a variable to carry the number of days within the week (strictly talking it’s best to most likely make it a continuing, but you by no means know the way

Visual Basic Programming

Visual Basic Programming

authorities regulations will change next…).

You might decide to call your variable intDaysWeek, and declare it like this:

DIM intDaysWeek AS Integer

On this case the prefix int denotes that the variable is of sort integer. Different widespread prefixes include:

lng – Long

dbl – Double

str – String

By the way, writing the variable title IntDaysWeek with a capital D and capital W is named “camel case”, so called because camels backs go up and down in the identical method as capitalised phrases like this do.

Two questions stay: is this a good suggestion? And why is it referred to as Modified Hungarian notation?

To answer the second question first, the notation was developed originally by a gentleman of Hungarian extraction, hence the name (though one other attainable motive for the title was that in Hungary folks put their surnames before their first names – so this article was written by Brown Andy). The “modified” little bit of the identify comes from the fact that a slgiht variation of the unique notation was then developed.

And is it a good suggestion? That relies on whether you prefer it or not. At Sensible Owl we tend to not use the notation for easy programming, because it creates cluttered, techie-trying code which is more difficult to read. Apart from, should you give variables smart names, it must be obvious what kind of information they contain. What else could the following variable include aside from a quantity, for example?

DIM NumberDaysInWeek As Integer

Nevertheless, we do make an exception for some issues (most notably controls on a person kind), the place it can be useful to know that every one textboxes (for instance) all start with txt. Which means that whenever you sort:

me.txt

you may be sure that the controls whose names seem are all the text bins on the form.

No related posts.

Category: Hardware  | Tags: , ,
You can follow any responses to this entry through the RSS 2.0 feed. You can leave a response, or trackback from your own site.
Leave a Reply