Introduction to Visual Basic



Similar documents
Microsoft Office Access 2007 Basics

Microsoft Access 2010 handout

Introduction To Microsoft Office PowerPoint Bob Booth July 2008 AP-PPT5

Making a Web Page with Microsoft Publisher 2003

Microsoft Access Basics

FileMaker Pro and Microsoft Office Integration

Tips and Tricks SAGE ACCPAC INTELLIGENCE

Using the Query Analyzer

OFFICE KEYBOARD (MT1210 & MT1405) OFFICE FEATURES

8 CREATING FORM WITH FORM WIZARD AND FORM DESIGNER

Using Virtual PC 7.0 for Mac with GalleryPro

Ansur Test Executive. Users Manual

Lesson 07: MS ACCESS - Handout. Introduction to database (30 mins)

Microsoft Outlook Introduction

Where do I start? DIGICATION E-PORTFOLIO HELP GUIDE. Log in to Digication

Sage Intelligence Financial Reporting for Sage ERP X3 Version 6.5 Installation Guide

Pastel Evolution BIC. Getting Started Guide

SIMATIC. WinCC V7.0. Getting started. Getting started. Welcome 2. Icons 3. Creating a project 4. Configure communication 5

Asset Track Getting Started Guide. An Introduction to Asset Track

Working with SQL Server Integration Services

14.1. bs^ir^qfkd=obcib`qflk= Ñçê=emI=rkfuI=~åÇ=léÉåsjp=eçëíë

MICROSOFT OFFICE ACCESS NEW FEATURES

DataPA OpenAnalytics End User Training

Database Automation using VBA

CHAPTER 1: CLIENT/SERVER INTEGRATED DEVELOPMENT ENVIRONMENT (C/SIDE)

for Sage 100 ERP Business Insights Overview Document

Intellect Platform - Tables and Templates Basic Document Management System - A101

Microsoft Access 2010 Part 1: Introduction to Access

DiskPulse DISK CHANGE MONITOR

BillQuick Agent 2010 Getting Started Guide

Visual Basic 2010 Essentials

Appendix A How to create a data-sharing lab

Release 2.1 of SAS Add-In for Microsoft Office Bringing Microsoft PowerPoint into the Mix ABSTRACT INTRODUCTION Data Access

The Reporting Console

Importing and Exporting With SPSS for Windows 17 TUT 117

What's New in BarTender 2016

EMCO Network Inventory 5.x

Microsoft PowerPoint Tutorial

Word basics. Before you begin. What you'll learn. Requirements. Estimated time to complete:

Bitrix Site Manager 4.1. User Guide

MS Access Lab 2. Topic: Tables

MGC WebCommander Web Server Manager

InfoView User s Guide. BusinessObjects Enterprise XI Release 2

Access 2010: The Navigation Pane

Content Author's Reference and Cookbook

BarTender s ActiveX Automation Interface. The World's Leading Software for Label, Barcode, RFID & Card Printing

Content Author's Reference and Cookbook

Getting Started Guide SAGE ACCPAC INTELLIGENCE

Sage ERP MAS 90 Sage ERP MAS 200 Sage ERP MAS 200 SQL. Installation and System Administrator's Guide 4MASIN450-08

Evaluator s Guide. PC-Duo Enterprise HelpDesk v5.0. Copyright 2006 Vector Networks Ltd and MetaQuest Software Inc. All rights reserved.

UNPAN Portal Content Management System (CMS) User Guide

Richmond Systems. SupportDesk Web Interface User Guide

Getting Started Guide

Module One: Getting Started Opening Outlook Setting Up Outlook for the First Time Understanding the Interface...

Simply Accounting Intelligence Tips and Tricks Booklet Vol. 1

Exploring Microsoft Office Access Chapter 2: Relational Databases and Multi-Table Queries

Outlook . User Guide IS TRAINING CENTER. 833 Chestnut St, Suite 600. Philadelphia, PA

Appointment Scheduler

Instruction manual. testo easyheat Configuration and Analysis software

MAS 500 Intelligence Tips and Tricks Booklet Vol. 1

TSM Studio Server User Guide

Network Administrator s Guide and Getting Started with Autodesk Ecotect Analysis

Microsoft Access Introduction

To determine the fields in a table decide what you need to know about the subject. Here are a few tips:

PowerPoint 2013 Basics of Creating a PowerPoint Presentation

MyOra 3.0. User Guide. SQL Tool for Oracle. Jayam Systems, LLC

The Microsoft Access 2007 Screen

Data Transfer Tips and Techniques

Getting Started with WebEx Access Anywhere

Database Concepts (3 rd Edition) APPENDIX D Getting Started with Microsoft Access 2007

How To Run A Factory I/O On A Microsoft Gpu 2.5 (Sdk) On A Computer Or Microsoft Powerbook 2.3 (Powerpoint) On An Android Computer Or Macbook 2 (Powerstation) On

13 Managing Devices. Your computer is an assembly of many components from different manufacturers. LESSON OBJECTIVES

Copyright EPiServer AB

Microsoft FrontPage 2003

Crystal Reports Payroll Exercise

How to Configure the Workflow Service and Design the Workflow Process Templates

Microsoft Access 2007 Introduction

Copyright 2006 TechSmith Corporation. All Rights Reserved.

Access Tutorial 6: Form Fundamentals

Creating a Web Site with Publisher 2010

BIGPOND ONLINE STORAGE USER GUIDE Issue August 2005

NDA ISSUE 1 STOCK # CallCenterWorX-Enterprise IMX MAT Quick Reference Guide MAY, NEC America, Inc.

COGNOS Query Studio Ad Hoc Reporting

Microsoft Access 2010 Overview of Basics

How To Learn To Write A Report In A Database On A Microsoft Powerbook

How To Create An Easybelle History Database On A Microsoft Powerbook (Windows)

Intellect Platform - The Workflow Engine Basic HelpDesk Troubleticket System - A102

Richmond SupportDesk Web Reports Module For Richmond SupportDesk v6.72. User Guide

Business Insight Report Authoring Getting Started Guide

GP REPORTS VIEWER USER GUIDE

Search help. More on Office.com: images templates

AXIS Camera Station Quick Installation Guide

Siemens Applied Automation Page 1 11/26/03 9:57 PM. Maxum ODBC 3.11

SMART Board Training Outline Trainer: Basel Badran

Web VTS Installation Guide. Copyright SiiTech Inc. All rights reserved.

SQL Server 2008 R2 Express Installation for Windows 7 Professional, Vista Business Edition and XP Professional.

Using the SAS Enterprise Guide (Version 4.2)

Microsoft Expression Web

Crystal Reports Installation Guide

Transcription:

Introduction to Visual Basic Microsoft Visual Basic development system version 6.0 is the most productive tool for creating high-performance components and applications. Visual Basic 6.0 offers developers the ability to create robust applications that reside on the client or server, or operate in a distributed n-tier environment. Visual Basic 6.0 is the Rapid Application Development (RAD) tool available either as a stand-alone product or as a part of the Visual Studio 6.0 suite of tools. Hardware & software requirements The following configuration is recommended: 1. Windows NT 4.0, Windows 95/98 operating system. 2. PC with an Intel Pentium processor 3. At least 32 MB of RAM (16 MB for Windows 95 or later) 4. Microsoft Internet Explorer version 4.01 or later. 5. Atleast 50MB of disk space Editions of VB 6.0 1. Learning Consists of all necessary tools required to build main stream Windows Applications 2. 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 Visual SourceSafe and the Automation and Component Manger. Features of visual basic Basic Features Form designer Create user Interface using design tools Add drawings to the forms Set properties for the individual object on the form Build an executable file Debug the applications Examine the objects in the forms Work with data in the programs (ODBC) Add more functionality to the program by writing code Create crystal Repots B 1

Comparison between Access and Visual Basic Features Access Visual Basic Form Designer Available Available with more advanced tools Design Tools Available Available with much enhanced tools Add drawings to Can be done Can be done with more options the forms Setting properties of the individual object on the form Building an Executable Debug the applications Examine the objects in the form Work with data in programs(odbc) Add more functionality to the program by writing code Create crystal reports Is possible Executable can be made with add-on utility Not present There is no option by which we can see all the objects at one place Is there Code can be written using Visual Basic which is altogether is a different software Not available Can be done in an easier manner and more properties available Utility for building executable is there with software This facility is available Object Browser is there to see all the objects at one place along with there methods and procedure Is there with more options for drivers Visual basic itself is used for writing code Is available as Add-on with Visual Basic B 2

Advanced features Integrate Visual database tools Visual Basic 6.0 provides a complete set of tools for integrating databases with any application. Database features include design tools for creating and modifying Microsoft SQL Server, Oracle 7.3.3 or above, and AS/400 databases. DataEnvironment designer for data connectivity Visually create reusable recordset command objects with drag-and-drop functionality. Bind to multiple data sources for data aggregation and manipulation. Drag and drop creation of data bound forms and reports Using the new Data Environment designer, developers can quickly drag-and-drop custom data-bound controls to create forms; they can create reports with the new Data Report Designer. Creation of custom data hierarchies is as easy as filling out a dialog box and dragging the command to the form. Visual Basic Web class Designer Create server-side applications and components that are easily accessible from any Web browser on any platform. Dynamic HTML Page Designer Develop multimedia-rich applications using the document object model and Dynamic HTML surface as the user interface. New performance enhancements Use new String Functions and features such as "Retain in Memory" to create faster, more scalable applications and components. The ActiveX Technology It is used to create Internet Enabled applications that are limited only by your imagination. Its come with several controls that allow you to create Web Based application. B 3

Visual basic environment (IDE) When using Visual Basic, the most important skill you need to be adopt at using the development environment. Without the integrated tools in the environment, VB programming would be much more cumbersome and difficult. All design would need to be done on graph paper and flow charts, and it would need to be typed in line by line. Fortunately, VB contains many integrated tools to make the application development process simpler. This collection of tools makes up the integrated development environment (IDE). B 4

Forms Window This is where you design your form. A form is what you will present to a user of your application. A form could be an introduction screen, it could be a dialog box giving the user options, it could be a box containing a warning. All of your VB programs will revolve around a number of forms. The Toolbar The toolbar provides quick access to commonly used commands. These will be explained later in the document. The Toolbox This floating window provides the tools for designing/creating an application on your form. They can create buttons, text boxes, labels, scroll bars and other commonly used windows items. The Property Window All items placed on a form have properties (explained in further detail later on) such as the colour of a button, what type of border a text box has or what font a label is displayed in. The Project Window A project is a complete application; this includes all the forms, programming code and other files needed to run this application. B 5

Details of the icons on the toolbar Icon Function Description Add Standard EXE Project This button will create a new project in VB. It will also create a new ActiveX EXE, ActiveX DLL or an ActiveX Control (none of these are covered in this course). Add Form Adds a new form to your project. This button will also add a new: MDI Form (Where you can have multiple instances of the same form on the screen) Module (A module contains general programming code independent of specific forms and controls. It contains things like variable declarations, constants, and user-defined sub-programs. Modules can be used in more than one application) Class Module User Control Property Page User Document You can also add an ActiveX designer application to VB or add an existing form, module, or other file to the current project using the Add File... command. B 6

Menu Design Window Open Project Save Project Cut, Copy and Paste Find Undo Redo Start Break Opens a window that lets you define your own menu systems for your applications. This is the same as going to the Tools menu and choosing the Menu Editor... command. Opens a previously saved application (applications are called Projects). This is the same as going to the File menu and choosing the Open Project command. Saves the current application/project. This is the same as going to the File menu and choosing the Save Project command. These are standard windows application buttons and work as in all Microsoft products. This is useful for finding keywords in code. Undoes the last action that you performed. It is not available if there is nothing to undo. Redos the last action that was undone. This will execute the current application (or resume a suspended one). It places you in Run mode. It is the same as going to the Run menu and choosing Start or Continue. This will pause the current application and will place you in Break mode. You can then test the program, using the debugging tools, to see if it is working correctly. You can also do this by going to the Run menu and choosing the Break command. To resume the application click on the Continue (the Start) button on the toolbar. B 7

End Project Explorer Properties Window Form Layout Window Object Browser Toolbox Data View Window Visual Component Manager This will end the current running application and return you to Design mode. You can also do this by going to the Run menu and choosing the End command. Displays the Project Window, which lists all of the files used in your application. This activates the Properties Window. You use the Properties window to assign attributes to items on a form. This is the same as going to the Window menu and choosing the Properties command. This shows the Form Layout Window, which lets you determine the starting position of your form relative to the screen. Brings up the Object Browser, which is used for finding out about objects, properties and methods (described later in this manual). This displays the Toolbox on the left of the screen. The Toolbox contains the objects that can be drawn on your form. This allows you to view all of the databases that you are connected to. You can see their tables, queries and other useful items. This will help advanced users to organise and sort their visual studio projects better. B 8

Visual Basic Project What is Visual Basic Project? Visual basic project basically consists of three parts --the user interface, the processing of information, and the storage of information. The user interface is the part of the program that your users see and with which they interact. This user interface is composed of the screens you design by using Visual Basic's forms and controls. The processing of information is done by the set of statements written to add the functionality to the object. The Storage for Information is generally any backend Database, which is connected to frontend by any of the standard Data Control or through Designers. Following are the Modules which are available in Visual Basic project to perform the above three tasks: 1. Form Module : It contains the graphic elements of the VB application along with the instruction. 2. General Module : It contains general-purpose instructions not pertaining to anything graphic on-screen 3. Class Module : It contains the defining characteristics of a class, including its properties and methods 4. Global Module : It contains declaration and procedures 5. Resource Files : It allows you to collect all of the texts and bitmaps for an application in one place When you start VB for the first time project wizard will be opened and following project templates will be displayed Standard EXE It is a typical Application. ActiveX EXE, ActiveX DLL Available with Professional Edition. ActiveX components are basic code-building elements that don t have a visible interface and that can add functionality to your applications. B 9

ActiveX Control Used to develop your own ActiveX controls. It is a basic element of the user interface. If the ActiveX control that comes with Visual Basic don t provide the required functionality then custom ActiveX controls can be build. ActiveX Document DLL, ActiveX Document EXE ActiveX documents are in essence Visual Basic applications that can run in the environment of a container that supports hyperlinking VB Application Wizard, VB Wizard Manager The Application Wizard takes through the steps of setting up the skeleton of a new application like a template in any MS-office component where basic structure is readily available and changes can be made depending on the need. Whereas VB Wizard Manager helps in building our own Wizard which is a sequence of windows that collects information from user required for building an application. Data Project This is a feature of enterprise edition that automatically adds the controls that are used in accessing databases to the Toolbox DHTML Application Allows to build Dynamic HTML pages that can be displayed in the browser's window on a client computer. It helps user in viewing the data lying with any RDBMS package at the backend and can also edit that and can do the queries also through browser itself. IIS Application Allows to build applications that run on the Web server and interact with clients over the Internet with Internet Information Server Add-In Own Add-Ins can be created for the Visual basic IDE. Add-Ins are special commands that can be added to Visual Basic menus VB Enterprise Edition Control It simply creates a new Standard EXE project and loads all the tools of the Enterprise Edition B 10

Steps for building a Visual Basic Application After designing the application, for building an application in Visual Basic following steps are to be taken : 1. Draw the Interface Create the form and the various objects on the form using toolbox. 2. Set the Properties Set the properties of the various objects on the form with the help of properties window. 3. Write the events code In the code window, write the code associated with each object on the form and then run the application B 11

Few Examples to start with Visual basic How to Start a project Start the visual basic by clicking Start>>Programs>>Microsoft Visual Studio 6.0>>Microsoft Visual Basic Choose Standard EXE from the available screen Click Open. A blank form will appear on the screen with Project Explorer Window, Properties Window and Tool Box. Project Explorer Window Properties Window View Object View Code Example 1: This example is to print a text in the text box by clicking on the button. With the help of Tool Box given on the left side of the interface, draw the following interface : Text Box (Text1) Command Button2 (Command2) Command Button1 (Command1) B 12

Set the properties of the objects on the form as given in the table below : Object Name Property Value Text Box Text1 Text <Blank> Command Button Command1 Caption Click here Command Button Command2 Caption Stop Double click First Command Button and write the following lines of code Private Sub Command1_Click() Text1.Text = "Welcome to Visual Basic" End Sub Click View Object to come back at the form Double click Second Command Button and write the following lines of code Private Sub Command2_Click() End End Sub Run the project by clicking Run>>Start or Press F5. Save the project by clicking File>>Save Project. Specify the folder in which all the files like form, reports etc. related with the project along with the project name are to be saved. Note : It is advised that one folder for each project should be created. B 13

Example 2: This example is to calculate the simple interest to be paid on the given principle amount, rate of interest and the number of years. Create a new Standard EXE Project by clicking on File>>New Project and then following the steps given in example 1. Draw the inteface as given below using the same Tool Box. Text Box (Text1) Text Box (Text2) Text Box (Text3) Text Box (Text4) Command Button1 (Command1) Label1 Label2 Label3 Label4 Object Property Value Text1 Text <Blank> Text2 Text <Blank> Text3 Text <Blank> Text4 Text <Blank> Label1 Caption Principal Amount Label2 Caption Rate of Interest Label3 Caption Number of Years Label4 Caption Interest to be paid Command1 Caption Calculate Double click Command1 and write the following line of code : Text4.Text = Text1.Text * Text2.Text * Text3.Text / 100 Run the Project and enter the values and then click the command button to see the result. B 14

Few Definitions to remember Few technical terms that will be used in the development of Visual Basic Project very often : Controls Reusable objects that provide the pieces of the visual interface of a program. Examples of controls are a text box, a label, or a command button. Event An action initiated by the user, the operating system, or the program itself. Examples of events are a keystroke, a mouse click, the expiration of a specified amount of time, or the receipt of data from a port. Methods Predefined actions that can be performed by an object. For example, a form has a Hide method that makes it invisible to the user. Object A basic element of a program, which contains properties to define its characteristics, contains methods to define its tasks, and recognizes events to which it can respond. Controls and forms are examples of the objects used in Visual Basic. Procedures Segments of code that you write to accomplish a task. Procedures are often written to respond to a specific event. Types of procedures include Sub procedures, which consist of a sequence of statements; and Functions, which return a value. Properties The characteristics of an object, such as its size, position, color, or text font. Properties determine the appearance and sometimes the behavior of an object. Properties are also used to provide data to an object and to retrieve information from the object. B 15