SYSTEMSDESIGNANALYSIS 1 OO: Chapter 9 Visual Basic: Building Components Jerry Post Copyright © 1999.

Slides:



Advertisements
Similar presentations
1 VBScript Session What we learn last session?
Advertisements

Integrated Business Applications with Databases (D3) Jenny Pedler
AE6382 VBA - Excel l VBA is Visual Basic for Applications l The goal is to demonstrate how VBA can be used to leverage the power of Excel u VBA syntax.
Tutorial 12: Enhancing Excel with Visual Basic for Applications
With Microsoft Excel 2010 © 2011 Pearson Education, Inc. Publishing as Prentice Hall1 PowerPoint Presentation to Accompany GO! with Microsoft ® Excel 2010.
Chapter 5 Menus, Common Dialog Boxes, Sub Procedures, and Function Procedures Copyright © 2011 by The McGraw-Hill Companies, Inc. All Rights Reserved.
Visual Basic Project Files:.VBP file: Project File: a small text file that contains the names of other files in the project, as well as some information.
Writing General Procedures Often you will encounter programming situations in which multiple procedures perform the same operation This condition can occur.
IS 1181 IS 118 Introduction to Development Tools VB Chapter 06.
Using Visual Basic 6.0 to Create Web-Based Database Applications
Visual Basic Project Files:.VBP file: Project File: a small text file that contains the names of other files in the project, as well as some information.
CVEV 118/698 Visual Basic Lecture 1 Prof. Mounir Mabsout Expert 1: Elsa Sulukdjian Expert 2: Walid El Asmar.
Creating Object Oriented Programs Object oriented (OO) terminology Class vs. object Instantiate an object in a project Understand Class_Initialize / Terminate.
VB Code Statements 3 types of VB statement The Remark statement, known as comments, are used for project documentation only Begin with an apostrophe Not.
To type the VB code behind the command button (named cmdPush), Double-Click on the Push Me (caption) command button As a result the Visual Basic Code Window.
Introduction to Class Modules Please use speaker notes for additional information!
Microsoft Visual Basic 2005 CHAPTER 8 Using Procedures and Exception Handling.
Introduction to Visual Basic (VB)
Microsoft Visual Basic 2012 Using Procedures and Exception Handling CHAPTER SEVEN.
CIS 338: Creating ActiveX Controls Dr. Ralph D. Westfall March, 2003.
Automating Tasks with Visual Basic. Introduction  When can’t find a readymade macro action that does the job you want, you can use Visual Basic code.
Using Visual Basic 6.0 to Create Web-Based Database Applications
Chapter 6 Understanding the Structure of an Application: Procedures, Modules, and Classes.
Chapter 2: Creating ActiveX Code Components By นภดล กมลวิลาศเสถียร Dept. of Computer Engineering, Prince of Songkla University Source: Mastering Visual.
An Introduction to Visual Basic
McGraw-Hill © 2009 The McGraw-Hill Companies, Inc. All rights reserved. Chapter 5 Menus, Common Dialog Boxes, Sub Procedures, and Function Procedures.
Multiple Forms, Container Controls, AddHandler This presentation is based on the Forms and ContainerControls VB Projects 1.
Programming Examples to Accompany Structure Topic Please use speaker notes for additional information!
Copyright © 2001 by Wiley. All rights reserved. Chapter 2: Using Visual Basic to Create a First Project Getting Started with VB Development Environment.
Introduction to the Visual Studio.NET IDE (LAB 1 )
Visual Basic.NET Comprehensive Concepts and Techniques Chapter 7 Using Menus, Common Dialogs, Procedures, Functions, and Arrays.
 Application – another name for a program.  Interface – is what appears on the screen when the application is running.  Program Code – is instructions.
Access VBA Programming for Beginners - Class 2 - by Patrick Lasu
VB Games: Preparing for Memory Brainstorm controls & events Parallel structures (again), Visibility, LoadPicture, User-defined procedures, Do While/Loop,busy.
Chapter Two Creating a First Project in Visual Basic.
7 Chapter Seven Client-side Scripts. 7 Chapter Objectives Create HTML forms Learn about client-side scripting languages Create a client-side script using.
Chapter 4 - Visual Basic Schneider1 Chapter 4 General Procedures.
Vocabulary in VB So Far. Assignment: Used to change the value of an object at run time Used to change the value of an object at run time.
PROGRAMMING IN VISUAL BASIC.NET VISUAL BASIC PROGRAMMING FUNDAMENTALS Bilal Munir Mughal 1 Chapter-8.
Spreadsheet Models for Managers: Session 14 14/1 Copyright © Richard Brenner Spreadsheet Models for Managers Session 14 Using Macros II Function.
Irwin/McGraw-Hill Copyright© 2000 by the McGraw-Hill Companies, Inc. PowerPoint® Presentation to accompany prepared by James T. Perry University of San.
Visual Basic for Application - Microsoft Access 2003 Programming applications using Objects.
Slide 1 Controls v Control naming convention –Label: lblName –Command Button: cmdName –Text Box: txtName.
Visual Basic Review LBS 126. VB programming Project Form 1Form 2Form 3 Text boxButton Picture box Objects Text box Button Objects.
SYSTEMSDESIGNANALYSIS 1 Chapter 21 Implementation Jerry Post Copyright © 1997.
Chapter 13 Copyright 2000 All rights reserved 1 Chapter 13 Object-Oriented Programming.
Chapter 4 - Visual Basic Schneider1 Chapter 4 General Procedures.
AVCE ICT – Unit 7 - Programming Session 12 - Debugging.
I am using Visual Basic 6 for this class. If you want to use a different version, please contact me. Thanks!
Week 1 Lecture 1 Slide 1 CP2028 Visual Basic Programming 2 “The VB Team” Copyright © University of Wolverhampton CP2028 Visual Basic Programming 2 v Week.
‘Tirgul’ # 5 Enterprise Development Using Visual Basic 6.0 Autumn 2002 Tirgul #5.
Chapter 7 Multiple Forms, Modules, and Menus. Section 7.2 MODULES A module contains code—declarations and procedures—that are used by other files in a.
Excel Functions. Part 1. Introduction 2 An Excel function is a formula or a procedure that is performed in the Visual Basic environment, outside the.
Chapter 2 Build Your First Project A Step-by-Step Approach 2 Exploring Microsoft Visual Basic 6.0 Copyright © 1999 Prentice-Hall, Inc. By Carlotta Eaton.
COMPREHENSIVE Excel Tutorial 12 Expanding Excel with Visual Basic for Applications.
1 Displaying Dialog Boxes Kashef Mughal. 2 Midterm Stats Here we go  Average was  Low was 116  High was 184  Mid Quarter Grade - check any.
Multiple Forms and Menus
A variable is a name for a value stored in memory.
VBA - Excel VBA is Visual Basic for Applications
VBA - Excel VBA is Visual Basic for Applications
3.01 Apply Controls Associated With Visual Studio Form
1. Introduction to Visual Basic
3.01 Apply Controls Associated With Visual Studio Form
Using Procedures and Exception Handling
Excel VBA Day 3 of 3 Tom Vorves.
Chapter 4 - Visual Basic Schneider
Department Array in Visual Basic
CS285 Introduction - Visual Basic
Chapter 8 - Functions and Functionality
Presentation transcript:

SYSTEMSDESIGNANALYSIS 1 OO: Chapter 9 Visual Basic: Building Components Jerry Post Copyright © 1999

SYSTEMSDESIGN 2 Components  A reusable class installed on Windows  Can be used in any standard programming system:  Visual Basic  C++  Internet Information Server  Excel, Access, …  Class properties or attributes  Class methods or functions

SYSTEMSDESIGN 3 Creating a Component in VB  Start Visual Basic (might not exist on student version)  File | New Project: Active X DLL  Project | Properties  Name, Description  Class Module  Properties: Name  Warning: Pick simple, informative names!

SYSTEMSDESIGN 4 VB Component Properties  Code: Create Variables to Hold Properties  Option Explicit (catches typos by requiring all variables to be pre- defined)  Declare property variables: Private m_InterestRate As Double Private m_Years As Integer Private m_FutureValue As Currency Private m_PresentValue As Currency  Tools | Add Procedure  Name  Property check box  Public

SYSTEMSDESIGN 5 VB Property Code Option Explicit Private m_InterestRate Public Property Get InterestRate() As Variant InterestRate = m_InterestRate End Property Public Property Let InterestRate(ByVal vNewValue As Variant) m_InterestRate = vNewValue End Property Retrieve a property value from the object and give it to caller. Accept a property value, test it, and store it in the object.

SYSTEMSDESIGN 6 VB Methods (Function or Sub)  Tools | Add Procedure  Name  Property check box  Public  Write code  Use property variables  Assign property variables Public Sub NPV() m_PresentValue = m_FutureValue / (1 + m_InterestRate) ^ m_Years End Sub

SYSTEMSDESIGN 7 VB Testing and Building Components  Save the project: File | Save  Add a new project (for testing)  File | Add Project: Standard EXE  Make the Component visible  Project | References  Create a form for the user  Add input boxes, and a command button (or other event)  Code to activate and use the component Private Sub cmdCompute_Click() Dim obj As Compute Set obj = CreateObject("SimpleFinance.Compute") obj.FutureValue = txtFuture obj.InterestRate = txtInterestRate obj.Years = txtYears obj.NPV txt.PresentValue = obj.PresentValue End Sub

SYSTEMSDESIGN 8 Finalizing VB Components  Add error handling and return messages/flags.  Test it extensively.  Build the DLL: File | Make ….dll  Distribute the DLL and the applications.  Register the DLL: regsvr32 SimpleFinance.dll  To remove it: regsvr32 /u SimpleFinance.dll