What Is a Dim Statement in Visual Basic?

In Visual Basic, a Dim statement is used to declare a variable for use in a program. The Dim command also allocates an appropriate amount of memory for the computer to store the value of the variable.

Visual Basic supports a variety of variable types. Boolean variables can only have two possible values, true (1) and false (0), and use a relatively small amount of memory as compared to other variable types. Integer variables can take on any whole number value such as 0, 1 or 46. Programs also use string variables that contain textual data such as “Baltimore, MD 21230.” By using Dim statements appropriately, programmers are able to develop useful software that efficiently uses a computer’s memory.

ADVERTISEMENT