Short for VB by AbbreviationFinder, Visual Basic is a programming language developed by the German Alan Cooper for Microsoft. The programming language is a dialect of BASIC, with important additions. Its first version was presented in 1991, with the intention of simplifying programming using a completely graphical development environment that facilitated the creation of graphical interfaces and, to a certain extent, also the Programming itself. Since 2001 Microsoft has proposed to abandon the development based on the Win32 API and move to work on a framework or common framework of libraries independent of the version of the operating system, NET Framework, through Visual Basic, NET (and other languages such as C Sharp (C #) for easy code transition between them).
Visual basic. It constitutes an IDE (Integrated Development Environment) that has been packaged as an Application Program; that is, it consists of a code editor (program where the source code is written), a debugger (program that corrects errors in the source code so that it can be well compiled), a compiler (program that translates the source code into the language of machine), and a graphical interface or GUI builder (it is a way of programming in which it is not necessary to write the code for the graphical part of the Program, but it can be done visually).
With Visual Basic, you can develop Windows applications more quickly. Programming errors are not generated as frequently and, if they do, they are easier to debug. It also includes two important concepts:
- A visual method of creating applications, including forms (Windows), controls, and form components.
- The ability to associate code directly to each event of each element of the visual design.
- It is possible to write applications without using visual components, that is, write console applications.
Visual and event-driven programming
A Program made in two is a set of statements that are executed from top to bottom more or less, in the order that the programmer has designed. An application in Windows presents all the possible options in one or more Forms for the user to choose between them. The sequence in which the statements will be executed cannot be predicted by the programmer. This results in event-oriented programming.
To program an application in Windows, separate code must be written for each object in general, leaving the application divided into small procedures, each one driven by an event. An event is an action recognized by an object (form or control) the event can be caused by the user or indirectly by the code.
In Visual Basic each form and each control has a predefined set of events. When these events occur, Visual Basic invokes the procedure associated with the object for that event. To develop an application in Visual_Basic, the steps to be followed are:
1.Create the user interface.
2.Modify the properties of each object.
- Write the code associated with the events of each object.
The Visual Basic environment
The elements that make up the Visual Basic screen are:
Menu bar. View the commands that are used to develop, test, and archive an application. The menus that we find are:
- File:contains the commands for working with files.
- Editing:Contains the tools that help to write the code.
- View:gives quick access to all parts of the Program.
- Insert:allows you to include new modules and forms in the application.
- Run:allows you to verify the application while it is being developed.
- Tools:controls the appearance and properties of the environment.
- Complements:contains the utilities for managing databases.
- Help:provides a valuable, comfortable and powerful help, very well thought out and elaborated, with which the beginner can learn many things and the experienced programmer can help himself when necessary.
Window or toolbar. Facilitates the use of the most common commands. From left to right, the icons that appear allow:
- Form: create a new Form.
- Module:create a new module. Used to create form-independent code snippets.
- Open Project:open a project.
- Save Project:save a project.
- Lock Controls –Prevent controls on the form from being moved unintentionally.
- Menu Editor:display the menu design window.
- Properties:display the properties window of the different objects.
- Object Browser:show classes, methods, properties, etc. of the objects available in the application.
- Project:display the Project Window.
- Start:run the designed application and thus be able to test its operation.
- Interrupt:pause the execution of the application under test, which can be restarted at any time with the continue button.
- Terminate: Terminatethe execution of the application under test to return to the design stage.
- Toggle Breakpoints:
- Instant Inspection:display the value of the selected element in the code window.
- Calls:view the active call structure.
- Step by step instructions:
- Step by Step by procedures:
Tool box. It provides a set of tools that allow you to place the controls on the form during the project design. Project window. In this window the files (forms, modules, etc.) that make up the application are specified and where they will be selected to create or modify them. This is because there are files that can be used in more than one application. It also contains two buttons: View Form that displays the selected form and; See Code that displays the code of the selected file.
Form window. It is the window that gives rise to the user interface. It is the window to be customized. The points that appear on the form, form a grid that helps when aligning the controls that are placed on it. This grid disappears at run time. To eliminate it at design time, access the option Tools / Options / Environment Tab / Show Grid.
Properties window. Specify the properties of each of the objects. At all times it will show the properties of the object selected in the form. It consists of two parts: the drop-down list of objects that displays the name of the selected object, and the list of properties of the selected object.
Design and execution mode
In design mode, the user interactively builds the application, placing controls on the form, defining their properties and developing functions to handle events. The application runs in run mode. In this case, the user acts on the program (Enter events) and tests how the program responds.
What Happens When I Run a Visual Basic Application?
The events that will take place when executing an application are:
-Form Paint (only in case the AutoRedraw property of the form is set to False) and, before unloading a form from memory, the events that take place are:
- Form Terminate
- Form Unload
How does a Visual Basic application work?
Normally, you write code to the events you want to respond to. If the event has no response or does not occur, Visual Basic will do nothing, that is, no code will be executed. In order to execute code, it will have to have responded to some event of a control and that event must take place.
Is Visual Basic 4.0 Object Oriented?
Visual Basic 4.0 is the first truly object-oriented version. It fulfills the three key concepts:
Encapsulation: You use it differently than C ++. Visual Basic objects have properties such as color, size, font, and also incorporate methods that respond to messages such as mouse clicks, keystrokes, etc. In which code can be integrated. Polymorphism: Ability to react differently to an identical message, depending on the object that receives it, eg a mouse click received by a command button or by a text box. Inheritance: Ability to be derived from another object.
- Microsoft Visual Basic 6.0 Common Controls
- Visual Basic Manuals (for scripting)
- Visual Basic 2005 Express Edition – Visual Basic.NET Free Edition website
- Visual Basic in Open Directory Project