E N D
Visual Basic By Mandavi Classes
Contend Introduction Definition Features Variables Declaration
Introduction to Visual Basic Visual Basic is a programming language and development environment created by Microsoft. Visual Basic provides a graphical user interface GUI that allows the developer drag and drop objects into the program as well as manually write program code. Visual Basic, also referred to as "VB," is designed to make software development easy and efficient
Visual Basic 6.0 1. Visual Basic is a programming language and integrated development environment. 2. It derives from the much older BASIC programming language, and so is considered useful and easy programming language for the beginner to learn. 3. Visual Basic 6.0 was the final edition of Visual Basic.
VISUAL BASIC: - GUI (Graphical User Interface) • Easy to use / Interact • Easy to understand and process • Nearly every action can be implemented with click of the mouse cursor. Visual Basic is referred as event driven programming language because each and every execution of the instruction is executed on the occurrence of any event. These events are always related with controls and components of the Visual Basic package. The event can be related to button, text boxes etc. where it can be a click event of the mouse cursor, change event of the text box and so many which relates the entire package to a GUI package with all the advantages of GUI based applications.
Feature Of visual basic 6.01. Learning Consists of all necessary tools required to build main stream Windows Applications2. Professional Includes advanced features such as tools to develop ActiveX and Internet controls.3. Enterprise In addition to all Professional features, it also includes tools such as VisualGUI Interface Modularization Object Oriented Debugging Macros IDE Data access feature
Guo Interface: - VB is a Graphical User Interface language. This means that a VB program will always show something on the screen that the user can interact with to get a job done. Modularization: - It is considered good programming practice to modularize your programs. Small modules where it is clearly indicated what comes into the module and what goes out makes a program easy to understand. Object Oriented: - Object Oriented Programming is a concept where the programmer thinks of the program in "objects" that interact with each other. Visual Basic forces this good programming practice. windows and editors.
The Major advantages of GUI based applications are: - • User Friendly: - It is very easy to use by the user who is not highly computer literate. • Easy to Understand: - The applications developed from Visual Basic package can redirect the information to the users so that their interaction with the system can be made very easy. • Processing is Simple: - The user can interact with the application by just using the mouse cursor and performing the click events which allows to execute the instructions internally. • Easy to Developer: - The development of any application in the Visual Basic environment is very simple because there are inbuilt controls and components which are ready to use in drag and drop mode. The interfaces can be easily designed and instructions can be placed for different processing under different actions. The only major disadvantage in respect to the restriction on the programmer or developer regarding the limitation in number of controls attributes for the controls and events for the control. The developer is
Variable Declaration: - In Visual Basic environment, the variables are declared for accepting the values from the controls in the application. There are three categories in which declaration of variable is performed. They are mention below: - Syntax: - Dim <variable/object> as <data type/class> Example: - Dim a as integer Dim a, b, c as integer • Local Variable: - Whenever any variable is declared within an event or method of an interface is referred as local variable. They are not accessible outside the event or method.
Semi-Global: - This declaration of variable acts partially like semi-global and as well as global. This declaration is performed under general declaration of the code window and are supposed to be accessible in all the events or methods define for the interface. If there is only one interface then it acts like global variable but when there is more than one form in the application, it acts like semi-global variable. • Global Variable: - The concept of global variable in the Visual Basic application is related with accessing the variable in all the forms or interfaces in the application. The global variables or methods are declared in a “module” which can be placed in the application from the project menu. The important aspect in declaring global variable is in the use of “public” keyword. The variables and methods in modules are defined as public.
Option Explicit: - The variable declaration in Visual Basic environment can be forced by the compiler and as well as can be ignored by the compiler. When it is necessary to declare the variable and the compiler also validates the declaration of variable then option explicit is placed as the first line of code in the code window. When the declaration is not mandatory then option explicit is removed from the code window. It’s a standard practice to declare all types of variables in the application. So that accurate values can be stored in the respective variables.
Code Window • Private Sub Command1_Click ( ) .................................................... .................................................... End Sub This is the most generic set of code visible in the code window which allows the user to identify the type of action to be performed in the application. The very first word “Private” denotes that the scope of the action is limited to the interface or form where it belongs. It can't be accessed outside the form. The second word “Sub” represents subroutine which instructs the compiler regarding the set of instructions provided by the user for execution and it doesn't return any value. The next word is combination of control and action for the user interface. It describes the specific control with events so that the execution of instructions can be performed when that specific action occurs.
The concluding combination i.e. “End Sub” represents the termination of the particular subroutine. It is essential because there is no curly brace to represent the termination of the event or subroutine. • Private/Public Function <function name> (...........) <return type> ............................................................................................. ............................................................................................. End Function The above block represents the declaration of a function in the Visual Basic environment. The first word is similar with respect to subroutine but when the scope of the function is to be declared as global accessibility then the access specifier public is used otherwise for a single form or user interface private access specifier is used.
The next word function is also a keyword in the Visual Basic environment which suggests the compiler that a set of instructions will be executed and at the same time when the execution will complete it returns the value to the calling function, subroutine or event. It also accepts argument which can be supplied from user interface control or variables. As the function returns a value it is necessary to declare the return type of the function. The return type is mention after the parameter list. It is obvious that the function should be terminated and for that “End Function” is used.
Created By Mandavi Classes www.miitpatna.com For full Notes and project contact me @7631205203