Saturday, February 27, 2010

Writing the Code

Each control or object in VB can usually run many kinds of events or procedures; these events are listed in the dropdown list in the code window  that is displayed when you double-click on an object and click on the procedures’ box(refer to Figure 2.3). Among the events are loading a form, clicking of a command button, pressing a key on the keyboard or dragging an object and more. For each event, you need to write an event procedure so that it can perform  an action or a series of actions
To start writing an event procedure, you need to double-click an object. For example, if you want to write an event procedure when a user clicks   a command button, you double-click on the command button and an event procedure will appear as shown in Figure 2.1. It takes the following format: 

Private Sub Command1_Click
(Key in your program code here)
End Sub

Friday, February 19, 2010

Working With Controls

3.1 The Control Properties

Before writing an event procedure for the control to response to a user's input, you have to set certain properties for the control to determine its appearance and how it will work with the event procedure. You can set the properties of the controls in the properties window or at runtime.

Figure 3.1 on the right is a typical properties window for a form. You can rename the form caption to any name that you like best. In the properties window, the item appears at the top part is the object currently selected (in Figure 3.1, the object selected is Form1). At the bottom part, the items listed in the left column represent the names of various properties associated with the selected object while the items listed in the right column represent the states of the properties. Properties can be set by highlighting the items in the right column then change them by typing or selecting the options available.

For example, in order to change the caption, just highlight Form1 under the name Caption and change it to other names. You may also try to alter the appearance of the form by setting it to 3D or flat. Other things you can do are to change its foreground and background color, change the font type and font size, enable or disable minimize and maximize buttons and etc.

Tuesday, February 16, 2010

Building Visual Basic Applications

2.1 Creating Your First Application

In this section, we will not go into the technical aspects of Visual Basic programming yet, what you need to do is just try out the examples below to see how does in VB program look like:
Example 2.1.1 is a simple program. First of all, you have to launch Microsoft Visual Basic 6. Normally, a default form with the name Form1 will be available for you to start your new project. Now, double click on Form1, the source code window for Form1 as shown in figure 2.1 will appear. The top of the source code window consists of a list of objects and their associated events or procedures. In figure 2.1, the object displayed is Form and the associated procedure is Load.


Figure 2.1 Source Code Window

Friday, February 12, 2010

Introduction to Visual Basic 6

1.1 The concept of computer programming

Before we begin Visual Basic 6 programming, let us understand some basic concepts of programming. According to Webopedia, a computer program is an organized list of instructions that, when executed, causes the computer to behave in a predetermined manner. Without programs, computers are useless. Therefore, programming means designing or creating a set of instructions to ask the computer to carry out certain jobs which normally are very much faster than human beings can do.
A lot of people think that computer CPU is a very intelligent thing, which in actual fact it is a dumb and inanimate object that can do nothing without human assistant. The microchips of a CPU can only understand two distinct electrical states, namely, the on and off states, or 0 and 1 codes in the binary system. So, the CPU only understands a combinations of 0 and 1 codes, a language which we called machine language. Machine language is extremely difficult to learn and it is not for us laymen to master it easily. Fortunately , we have many smart programmers who wrote interpreters and compilers that can translate human language-like programs such as BASIC into machine language so that the computer can carry out the instructions entered by the users. Machine language is known as the primitive language while Interpreters and compilers like Visual Basic are called high-level language. Some of the high level computer languages beside Visual Basic are Fortran, Cobol, Java, C, C++, Turbo Pascal, and etc .

Tuesday, February 2, 2010

==Timeline of Visual Basic (VB1 to VB6)==

* Project 'Thunder' was initiated
* Visual Basic 1.0 (May [[1991]]) was released for Windows at the Comdex/Windows World trade show in Atlanta, Georgia.
[[Image:VBDOS-icon.PNG|right|VB DOS Logo]]
[[Image:Microsoft Visual Basic for MS-DOS (Professional Edition Version1.00).png|thumb|right|300px|Visual Basic for MS-DOS]]
* Visual Basic 1.0 for [[DOS]] was released in September [[1992]]. The language itself was not quite compatible with Visual Basic for Windows, as it was actually the next version of Microsoft's DOS-based BASIC compilers, [[QuickBASIC]] and BASIC Professional Development System. The interface used the [[Character Oriented Windows|"COW" (Character Oriented Windows)]] interface, using [[extended ASCII]] characters to simulate the appearance of a [[Graphical user interface|GUI]].
* Visual Basic 2.0 was released in November [[1992]]. The programming environment was easier to use, and its speed was improved. Notably, forms became instantiable objects, thus laying the foundational concepts of class modules as were later offered in VB4.
* Visual Basic 3.0 was released in the summer of [[1993]] and came in Standard and Professional versions. VB3 included version 1.1 of the [[Microsoft Jet Database Engine]] that could read and write Jet (or Access) 1.x databases.
* Visual Basic 4.0 (August [[1995]]) was the first version that could create [[32-bit]] as well as [[16-bit]] Windows programs. It also introduced the ability to write non-GUI classes in Visual Basic. Incompatibilities between different releases of VB4 caused installation and operation problems. While previous versions of Visual Basic had used VBX controls, Visual Basic now used OLE controls (with files names ending in .OCX) instead. These were later to be named ActiveX controls.