Introduction To Visual Basic Application Development (Practical)


CHAPTER 02


Introduction To Visual Basic Application Development

Visual Basic : Introduction
  • “Visual” refers to the method used to create what the user sees (Graphical User interface).
  • “Basic” refers to the BASIC (Beginners All-Purpose Symbolic Instruction Code) programming language.
  • It is a high-level programming language that evolved from the earlier DOS version called BASIC.
  • Visual Basic originally created to make it easier to write programs for the Windows computer operating system.
  • One of the major reasons why Visual Basic has been so successful is that it includes everything that is necessary to write programs forWindows.
  • For many years, Microsoft Visual Basic has been the world’s most popular programming language.
  • From its very beginning, Visual Basic has brought unmatched flexibility and ease of programming to theWindows platform.
  • In its previous six versions, Visual Basic evolved into an extremely powerful development tool that was equally at home in business, academia, engineering, or everywhere else in which windows applications were being created.
  • The latest version of Visual Basic, called Visual basic .NET, is the most significant evolutionary change yet in the language. (Introduction To Visual Basic)

General Features Of The Visual Basic

  • GUI:- Graphical User Interface is there to represent the program objects and also the techniques.
  • Modularization:- Good program practice to modularize program.
  • Object-Oriented:- Creating objects while writing programs.
  • Debugging:- Runtime debugger helps to find and also fix the bugs/ errors at runtime.
  • Data Access aspect:- Users can able to create a database and also retrieve data at runtime.

Introduction to Visual Studio Express 2012

Introduction to Visual Studio Express 2012
  • Visual Basic Express 2012 is almost similar to Visual Basic Express 2010 & 2008, but it has added many new features.
  • Visual Basic Express 2012 no more comes as a stand-alone program, it is now integrating with other Microsoft Programming languages C# and also C++ in a package called visual Studio 2012.

(Introduction To Visual Basic Application Development)


.NET Framework Architecture

.NET Framework Architecture
  • The .NET Framework is Microsoft’s new platform for the development and implementation of applications program.
  • Simply, .NET is a new framework for developing web-based and also windows-based applications within the Microsoft environment.
  • Microsoft and other publishers of development tools realized that they could write the code needed to perform a variety of commonly needed tasks and also make this functionality available to the programmer in an easy-to-use form.
  • So, the framework did all the work behind the scenes, serving as an interface between the program and the operating system.
  • Two main parts of the .NET framework are:
    • Common Language Runtime.
    • .NET framework classes/ libraries.

Common Language Runtime (CLR)

Common Language Run time (CLR)

CLR is considering as the heart of .NET. It also provides a “runtime environment” for the execution of code written in any .NET Language.

  • Features :
    • Common type system
    • Common metadata
    • Intermediate Language (IL) to native code compilers
    • Code execution and security
  • Additional services :
    • Memory Management
    • Thread Management
    • Garbage Handling
    • Exception Handling
  • Much of the functionality available to the VB .NET programmer is provided by the .NET Class Framework.
  • This is a rich set of classes, interfaces, and also structures that provides support for data storage, access to system services, input/output, security and a whole host of other things that the programmer needs.
  • The class framework is arranged hierarchically using the concept of namespaces.
  • A namespace is nothing more than an identifier that is used to group related items together.
  • The root namespace contains classes for all of the base data types (Integer, Char, Array and so on) as well as for the Object type that is the base for all .NET components.
  • Applications that can make use of .net class library:
    • Windows applications
    • Console applications
    • Web applications
    • XML web applications/services
    • Windows services

Elements of a Visual Basic Application

From a programming viewpoint, Visual Basic is an object-oriented that consists of two fundamental parts.

A visual part and a language part

  • The visual part of the language consists of a set of objects, while the language part consists of a high-level procedural programming language.
  • These two elements of the language are using together to create applications.
  • Thus, for our purposes, we can express the elements of a visual basic application as:
A visual part and a language part

(Introduction To Visual Basic Application Development)


The Visual Element

  • From a user’s standpoint, the visual part of an application is provided within a window. This is the graphical interface that allows the user to see the input and also output provided by the application.
  • This user interfaces referred to as the graphical user interface (GUI).
  • From a programmer’s perspective, the GUI is constructed by placing a set of visual objects on a blank window, or form, when the program is being developed.
The Visual Element
  • The programmer can place various objects on this form, which is itself a Visual Basic object.
  • When an application is run, the form becomes a window that provides the background for the various objects placed on the form by the programmer.
  • The standard object Tool-box contains the objects we will use in constructing each graphical user interface.
The Visual Element (contd…)

Fundamental Object Types and their Uses

Fundamental Object Types and their Uses Introduction To Visual Basic Application Development

Creating a Visual Basic program

  • To create a Visual basic program you will need the following three windows:
    • Toolbox window for selecting objects
    • Form window for placing objects
    • The properties window for altering an object’s properties

Additionally, the Solution Explorer window should be visible when you begin.

  • Once the design windows are visible, creating a Visual Basic application requires the following three steps:
    • Create the graphical user interface
    • Set the properties of each object on the interface
    • Write the code

Setting an Object’s Properties

  • All objects on a form have properties, which define where on the form the object will appear. The color of the object, its size, and also various other attributes.
  • The properties window allows properties to be listed in alphabetic order, by property name or by property category, By default, also the properties are sorted by category.
  • The two columns within the properties window are where individual object properties are identified.
    • The column on the left is the properties list, which provides the names of the properties of the object also named in the object box.
    • The column to the right is the settings list, which provides the current value assigned to the property also on the left.
    • The currently selected property is the one that is highlighted.

(Introduction To Visual Basic Application Development)


The Properties Window

Introduction To Visual Basic Application Development

Basic Concepts in Introduction To Visual Basic Application Development

The Name Property:

  • The names that are allowed for all objects are also used to name other elements in the Visual Basic programming language and are collectively referred to as identifiers. Identifiers can be made up of any combination of letters, digits or underscores( _ ) selected according to the following rules:
    1. The first character of an identifier must be a letter.
    2. Only letters, digits or underscores may follow the initial letter (Blank spaces, special characters, and also punctuation marks are not allowed)
    3. An identifier can be no longer than 1016 characters
    4. An identifier cannot be a keyword.

Running an Application:

  • At any time during program development, you can run your program using one of the following three methods:
    1. Select the Debug Menu and Click Start
    2. Press the F5 function key
    3. Use the hotkey Alt + D, then press the S key.

Saving a Project:

  • Click the File menu and then click Save All.
    • At this point, all the forms, code modules, and ancillary files will be saved in a folder. Also, the name of the folder will be the project name.

OR

  • Click ” SaveAll ” icon in the Standard Toolbar.
    • Also, It recommends you save your solution to prevent accidental loss of work.

Adding an Event Procedure

  • In a well-designed program, each procedure will consist of a set of instructions necessary to complete and also a well-defined task.
  • Although a procedure that is executed when an event occurs is referred to as an event procedure or event handler.
  • The following slide illustrated The general structure of an event procedure:
Introduction To Visual Basic Application Development
Introduction To Visual Basic Application Development

Write two simple event procedures for action while a form loading in the execution of VB .NET

Example 1:

execution of VB .NET

Example 2:

execution of VB .NET
  • The first line of a procedure is always and also a header line.
  • A header line begins with the optional keyword Private and must contain the keyword Sub (which derives from the word Subprogram), the name of the procedure and also a set of parentheses.
  • For event procedures, the name consists of
    • an object identification,
    • an optional underscore character ( _ ),
    • a valid event for the object,
    • the parameters in parentheses,
    • the keyword Handles followed by the object identification,
    • an underscore character &
    • a valid event.
  • Event procedure templates need not be manually typed because they are automatically provided in the visual Basic Code window.
  • Before activating the code window, we need to decide what Visual Basic statements will be included in the body of our event procedure. (Introduction To Visual Basic Application Development)

Find some additional features of VB .NET compared to VB

For the Visual Application Development (Theory) lesson, click here. also, you can refer more in here.

Leave a Comment

Your email address will not be published. Required fields are marked *