Category Archive for: Visual Basic: The Language

Forcing Variable Declarations

Visual Basic doesn’t enforce variable declaration, which is a good thing for the average programmer. When you want to slap together a “quick-and-dirty” pro-gram, the last thing you need is someone telling You Ito decide which variables you’re going to use and to declare them before using them. But most programmers accustomed to the free format of Visual…

Read More →

Examining Variable Types

Besides setting the types of variables and the functions for converting between types, Visual Basic provides two functions that let you examine the-type of a variable. They are the VarType() and TypeName() functions. Both functions accept as argument the name of a variable, and they return a number (the VarType() function) or a string (the TypeName() function) indicating the type…

Read More →

Special Values

Variables have the values your program assigns to them. Before ally value is assigned ‘ to them, numeric variables are zero, and string variables are zero length (“”). There are, however, four special values: Empty, Null, Nothing, and Error, The Empty Value If a variant variable has been declared, but has not yet ( been assigned a value,…

Read More →

Object Variables

An object variable refers to one of Visual Basic’s many objects, and you can use an object variable to access the actual object. You will see examples of object variables in Parts IV and V of the book Here is a simple example of an-object variable. A Form has two Command buttons on it, Command 1 and Command…

Read More →

Some Tricks for Improving Accuracy

If your calculation  require the maximum precision possible, here are a few  but effective, tricks. Bias the numbers If you’re doing calculation In the range 100,010 to 100,100, subtract 100,000 from the Initial numbers to reduce the values In the range to 10 to 100′ When you’ are done, add the bias 100,000 to the result. Manipulate your expression  Examine your…

Read More →

Variables

In Visual Basic, as in any other programming language, variables store values during a program’s execution. For example, you’re writing a program that frequently prompts the user for data, and you decide to add a personal touch to the interface. Every time the program needs data, it will display the user’s name. Instead of writing an application for Joe…

Read More →

Visual Basic: The Language

This chapter discusses the fundamentals of any programming language: variables and procedures. A variable stores data, and a procedure is code that manipulates variables. To do any serious programming with Visual Basic, you must be familiar with these concepts. To write efficient applications, you need a basic understanding some fundamental topics, such as the types, scope, and lifetime of…

Read More →

Back to Top