Project Structure and Tools 1120-Ch2.PPT

Slides:



Advertisements
Similar presentations
Chapter 1: An Introduction to Visual Basic 2012
Advertisements

Using Macros and Visual Basic for Applications (VBA) with Excel
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.
Introduction to computers & Visual Basic School of Business Eastern Illinois University © Abdou Illia, Spring 2003 (Week 3, Monday 1/27/2003)
1 Introduction to the Visual Studio.NET IDE Powerpoint slides modified from Deitel & Deitel.
Office 2003 Post-Advanced Concepts and Techniques M i c r o s o f t Word Project 8 Working with Macros and Visual Basic for Applications (VBA)
Adding Controls to User Forms. Adding Controls A user form isn’t much use without some controls We’re going to add controls and write code for them Note.
Microsoft Visual Basic 2010: Reloaded Fourth Edition Chapter One An Introduction to Visual Basic 2010.
Slide 1 Chapter 2 Visual Basic Interface. Slide 2 Chapter 2 Windows GUI  A GUI is a graphical user interface.  The interface is what appears on the.
Visual Basic Chapter 1 Mr. Wangler.
Introduction to Visual Basic (VB)
Chapter 1 P. 1 Writing Windows applications with Visual Basic Figure 1.1 The first program works as follows: (These operations can be performed in any.
An Introduction to Visual Basic
© 2006 Lawrenceville Press Slide 1 Chapter 3 Visual Basic Interface.
Chapter 3 Introducing Visual Basic.NET. 3.1 Visual Basic.NET Windows Programming -Used to create Windows, Web, and Console applications -Uses predefined.
Chapter 1: An Introduction to Visual Basic 2005 Programming with Microsoft Visual Basic 2005, Third Edition.
Irwin/McGraw-Hill © The McGraw-Hill Companies, Inc., Visual Basic Projects Project Structure and VB’s Programming Tools chapter TWO.
Copyright © 2001 by Wiley. All rights reserved. Chapter 2: Using Visual Basic to Create a First Project Getting Started with VB Development Environment.
 Application – another name for a program.  Interface – is what appears on the screen when the application is running.  Program Code – is instructions.
Chapter One An Introduction to Visual Basic 2010 Programming with Microsoft Visual Basic th Edition.
Irwin/McGraw-Hill Copyright© 2000 by the McGraw-Hill Companies, Inc. PowerPoint® Presentation to accompany prepared by James T. Perry University of San.
Chapter Two Creating a First Project in Visual Basic.
CC111 Lec7 : Visual Basic 1 Visual Basic(1) Lecture 7.
Chapter 2 – Introduction to the Visual Studio .NET IDE
Visual Basic CDA College Limassol Campus Lecture:Pelekanou Olga Semester C Week - 1.
Visual Basic Programming Introduction VB is one of the High level language VB has evolved from the BASIC language. BASIC stands for Beginners All-purpose.
VB Objects & Events (Exercises) School of Business Eastern Illinois University © Abdou Illia, Spring 2003 (Week 3, Friday 1/31/2003)
1 Visual Basic Part I - A tool for customizing your program Principles of GIS
 2002 Prentice Hall. All rights reserved. 1 Chapter 2 – Introduction to the Visual Studio.NET IDE Outline 2.1Introduction 2.2Visual Studio.NET Integrated.
CMPF114 Computer Literacy Chapter 3 The Visual Basic Environment 1.
Microsoft Visual Basic 2008: Reloaded Third Edition Chapter One An Introduction to Visual Basic 2008.
Copyright © Don Kussee 1120-Ch2 #531 CNS 1120 Chapter 2 Project Structure and Tools 1120-Ch2.PPT.
Copyright (c) 2003 by Prentice Hall Provided By: Qasim Al-ajmi Chapter 2 Introduction to Visual Basic Programming Visual Basic.NET.
Visual Basic.NET Comprehensive Concepts and Techniques Chapter 3 Building an Application in the Visual Basic.NET Environment.
COMPUTER PROGRAMMING I 3.01 Apply Controls Associated With Visual Studio Form.
Copyright © Don Kussee 1410-Ch5 #1031 CNS 1120 Chapter 5 Selection statements 1120-Ch5.PPT.
TOOLBOX. The Toolbox Intrinsic Controls - always included in the Toolbox ActiveX Controls - separate files with ocx file extension Insertable Objects.
Visual Basic.Net. Software to Install Visual Studio 2005 Professional Edition (Requires Windows XP Pro) MSDN Library for Visual Studio 2005 Available.
IE 411/511: Visual Programming for Industrial Applications Lecture Notes #2 Introduction to the Visual Basic Express 2010 Integrated Development Environment.
COMPUTER PROGRAMMING I 3.01 Apply Controls Associated With Visual Studio Form.
 2002 Prentice Hall. All rights reserved. 1 Introduction to the Visual Studio.NET IDE Outline Introduction Visual Studio.NET Integrated Development Environment.
Microsoft Visual Basic 2012: Reloaded Fifth Edition Chapter One An Introduction to Visual Basic 2012.
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.
Programming with Microsoft Visual Basic 2012 Chapter 1: An Introduction to Visual Basic 2012.
Programming with Microsoft Visual Basic 2008 Fourth Edition Chapter One An Introduction to Visual Basic 2008.
Dive Into® Visual Basic 2010 Express
Chapter 1: An Introduction to Visual Basic .NET
Visual Basic.NET Windows Programming
Working in the Forms Developer Environment
Chapter 1: An Introduction to Visual Basic 2015
Introduction to Computer CC111
Chapter 8: Writing Graphical User Interfaces
Introduction to Computing
Chapter 2 – Introduction to the Visual Studio .NET IDE
An Introduction to Computers and Visual Basic
3.01 Apply Controls Associated With Visual Studio Form
1. Introduction to Visual Basic
3.01 Apply Controls Associated With Visual Studio Form
Chapter 2 Visual Basic Interface
Visual Basic Project Development Environment
Chapter 7 Advanced Form Techniques
Chapter 2 – Introduction to the Visual Studio .NET IDE
CIS16 Application Development Programming with Visual Basic
Hello World in Visual Basic
Building an Application in the Visual Basic .NET Environment
Introduction to Programming
Chapter 4 Enhancing the Graphical User Interface
Chapter 4 Enhancing the Graphical User Interface
Running Your Visual Basic Program
Presentation transcript:

Project Structure and Tools 1120-Ch2.PPT CNS 1120 Chapter 2 Introduction to Programming CNS 1120 Chapter 2 Project Structure and Tools 1120-Ch2.PPT Copyright © Don Kussee 1120-Ch2 #53

Structure of VB projects CNS 1120 Chapter 2 Structure of VB projects l l l l l l l l Project 0 or 1 0+ 0+ Resource file 0+ Forms 1 1+ Class modules* 0+ Code modules General declarations section 1 Controls 0+ General sub procedures 0+ General declarations section 1+ General sub procedures Properties Event procedures * The structure of class modules has been omitted for clarity.

Structure of VB projects CNS 1120 Chapter 2 Structure of VB projects l l l l l l l l The definition of what is included in the program. Project 0+ Forms Displayed “windows” 1 1+ 0+ General declarations section User interface object Controls General sub procedures 0+ 1+ Properties Event procedures Code Instructions to the computer

Copyright © Don Kussee 1120-Ch2 #53 CNS 1120 Chapter 2 Terms Project - all of the Forms, controls, code necessary for a program to run. Form - the screen we will design on, and the user will see. Controls or Objects - GUI objects attached to the form Expressions - code - the instructions that the computer will follow. Copyright © Don Kussee 1120-Ch2 #53

TOPE chart Task-Object-Event CNS 1120 Chapter 2 TOPE chart Task-Object-Event Task Object Property Event Copyright © Don Kussee 1120-Ch2 #53

VB Programming Process CNS 1120 Chapter 2 VB Programming Process Understand the user’s requirements Analyze - TOPE chart for inputs & outputs Develop the GUI forms to be used Place the controls on the forms Write code to hook the controls together Test and debug the program Create the executable program. Copyright © Don Kussee 1120-Ch2 #53

Copyright © Don Kussee 1120-Ch2 #53 CNS 1120 Chapter 2 Visual Basic Modes Design where most of our time will be spent Form, the tool bar and tool box are available Properties window is available Code window is available Run - where we will test & evaluate the program Break - where we can debug our problems Compile The program we will give to the user. Copyright © Don Kussee 1120-Ch2 #53

Copyright © Don Kussee 1120-Ch2 #53 CNS 1120 Chapter 2 The VB environment l l l l l l l l Copyright © Don Kussee 1120-Ch2 #53

Form frm 53 Properties, 31 Events, 21 Methods CNS 1120 Chapter 2 Form frm 53 Properties, 31 Events, 21 Methods

53 Properties Properties frm CNS 1120 Chapter 2 53 Properties Properties frm Copyright © Don Kussee 1120-Ch2 #53

Copyright © Don Kussee 1120-Ch2 #53 CNS 1120 Chapter 2 Form Events 31 Events Copyright © Don Kussee 1120-Ch2 #53

Copyright © Don Kussee 1120-Ch2 #53 CNS 1120 Chapter 2 Form methods 21 Methods Circle, Line, Point Cls, Hide, Show, Refresh Popup menu Drag, DragOver Move left, [top, [width, [height]]] SetFocus, GotFocus, LostFocus Copyright © Don Kussee 1120-Ch2 #53

Copyright © Don Kussee 1120-Ch2 #53 CNS 1120 Chapter 2 Properties of Forms Caption - Name at the top of the form BackColor - Systems colors or Palette WindowState - 0 = Just like design(Default) 1 = Minimized, 2 = Maximized Name used in code also is default file name Form1.BackColor = vbRed Form1.Label2.Forecolor = vbRed Copyright © Don Kussee 1120-Ch2 #53

Objects, Classes, Controls CNS 1120 Chapter 2 Objects, Classes, Controls Over 4000 different controls available - we will use about 10 Many special VBX on the internet NextPage Corp’s VBX is $ 5,000 VB assists in building of new Classes - ActiveX - VBX - OCX CNS 3200 includes these concepts Copyright © Don Kussee 1120-Ch2 #53

Controls, Objects, Classes CNS 1120 Chapter 2 Controls, Objects, Classes Label Text Box Control Button Copyright © Don Kussee 1120-Ch2 #53

Copyright © Don Kussee 1120-Ch2 #53 CNS 1120 Chapter 2 Programs Series of steps for the computer to follow Computer can be told to do only 5 things Input - Get data from outside Output - Supply data to outside Process - Add, Subtract, Multiply, etc Select - Equal to, less than, between Loop - Repeat some steps of a program Copyright © Don Kussee 1120-Ch2 #53

Controls, Objects, Classes CNS 1120 Chapter 2 Controls, Objects, Classes Label output Text Box input Command Button trigger Pickup truck - Red Dodge V-10 long bed Bird - Gray - “chi-cog-o” - top-feather - walks Computer- 300 Mhertz- 64M RAM- 17” screen Copyright © Don Kussee 1120-Ch2 #53

Controls 7 general categories CNS 1120 Chapter 2 Controls 7 general categories Trigger 3 Timer, Command button Input 6 TextBox, Combo, Scroll Output 4 Label, Textbox, Image Organize 3 Form, Frame Graphic 2 Line, Circle Data Access 4 Combo, Data Integration 1 OLE Copyright © Don Kussee 1120-Ch2 #53

Primary Controls for Input…………... Output………... CNS 1120 Chapter 2 Primary Controls for Input…………... Output………... Text box Command button MsgBox / InputBox Menu Check box Option buttons List / Combo box Scroll bars Text box MsgBox Label Image Picture Copyright © Don Kussee 1120-Ch2 #53

Controls - Object - Class CNS 1120 Chapter 2 Controls - Object - Class Properties that can change it’s appearance Size, shape, location, look, color Events that it can respond to Click, mouse over, drag Methods - things it can do Move, Connect, Load, Update Copyright © Don Kussee 1120-Ch2 #53

Real world objects properties, events, methods CNS 1120 Chapter 2 Real world objects properties, events, methods Cashier Woodpecker Grass Computer Student Professor Dog Vs Cat Airplane Jet ski Bicycle Bicycle rider Olympic Bicycle racer Car Duck Ostrich Duckbilled platypus Copyright © Don Kussee 1120-Ch2 #53

Copyright © Don Kussee 1120-Ch2 #53 CNS 1120 Chapter 2 VB Tool Box Label tool Used to label other controls, and provide output. Copyright © Don Kussee 1120-Ch2 #53

Copyright © Don Kussee 1120-Ch2 #53 CNS 1120 Chapter 2 Label lbl 48 Properties Appearance & location 23 Events Change Click DblClick Load 10 Methods Move Refresh ZOrder Copyright © Don Kussee 1120-Ch2 #53

Copyright © Don Kussee 1120-Ch2 #53 CNS 1120 Chapter 2 Label Copyright © Don Kussee 1120-Ch2 #53

Copyright © Don Kussee 1120-Ch2 #53 CNS 1120 Chapter 2 Label properties Name - used in code procedures Caption - displayed on the form or control Enabled - does it work Visible - can you see it Usual event - None Copyright © Don Kussee 1120-Ch2 #53

Copyright © Don Kussee 1120-Ch2 #53 CNS 1120 Chapter 2 Command Button cmd 17 Events Cause an user event to occur - Click usually 24 Methods 32 Properties for each instantiation Appearance Size, Shape, Location, Colors, Font, Style Caption - The title on the button Picture property - an image on the button Copyright © Don Kussee 1120-Ch2 #53

Command Button properties CNS 1120 Chapter 2 Command Button properties Name - used in code procedures Caption - displayed on the button Picture - displayed on the button Enabled - does it work Visible - can you see it Usual event - Click Copyright © Don Kussee 1120-Ch2 #53

CommandButton.Caption changed CNS 1120 Chapter 2 CommandButton.Caption changed Copyright © Don Kussee 1120-Ch2 #53

Copyright © Don Kussee 1120-Ch2 #53 CNS 1120 Chapter 2 Events Copyright © Don Kussee 1120-Ch2 #53

Processing code for Command Button CNS 1120 Chapter 2 Processing code for Command Button Note: header and indentation Copyright © Don Kussee 1120-Ch2 #53

Header required for every program CNS 1120 Chapter 2 Header required for every program Rem ********************************* Rem *** Program name *** ‘ *** Programmers name *** ‘ *** Date of program *** ‘ *** Description of the program *** ‘ ******************************** Copyright © Don Kussee 1120-Ch2 #53

Copyright © Don Kussee 1120-Ch2 #53 CNS 1120 Chapter 2 Demo of design mode Add a control 3 ways Double click, Draw, Copy & Paste Delete control Change properties 3 ways F4 Type over Additional menu … Choice items Copyright © Don Kussee 1120-Ch2 #53

Procedure Vs Event programming CNS 1120 Chapter 2 Procedure Vs Event programming Procedures ... the old way, it starts at the top and runs to the bottom every time - how a traffic light works, cars or no cars Event new way store clerks - demand The program waits, then reacts to some event. Reacts differently to different events. Event procedure is the detail code for the computer to follow Copyright © Don Kussee 1120-Ch2 #53

Copyright © Don Kussee 1120-Ch2 #53 CNS 1120 Chapter 2 Other VB Windows Form Layout Window Figure 2.25 Project Explorer Window Figure 2.26 Help Windows Figure 2.29 - 32 Copyright © Don Kussee 1120-Ch2 #53

Copyright © Don Kussee 1120-Ch2 #53 CNS 1120 Chapter 2 Stopping Visual Basic Include an Exit key in every project Ctr + Break will stop processing Run menu Square Alt + R Gets run menu - choose E Copyright © Don Kussee 1120-Ch2 #53

Copyright © Don Kussee 1120-Ch2 #53 CNS 1120 Chapter 2 The VB environment l l l l l l l l Copyright © Don Kussee 1120-Ch2 #53

Properties The currently selected control is named Command1 Object box CNS 1120 Chapter 2 Properties The currently selected control is named Command1 The setting for Command1’s Caption property is Command1 Property list Object box

Copyright © Don Kussee 1120-Ch2 #53 CNS 1120 Chapter 2 Code window Procedure box Object box Code area Copyright © Don Kussee 1120-Ch2 #53

Copyright © Don Kussee 1120-Ch2 #53 CNS 1120 Chapter 2 Code Window Each procedure has an Object_Event Copyright © Don Kussee 1120-Ch2 #53

Copyright © Don Kussee 1120-Ch2 #53 CNS 1120 Chapter 2 The VB environment l l l l l l l l Properties window Form window Menu bar Tool bar Toolbox Project window Code window Copyright © Don Kussee 1120-Ch2 #53

Copyright © Don Kussee 1120-Ch2 #53 CNS 1120 Chapter 2 Naming objects When projects get big (Project 2 Page 59 uses 17 labels) naming objects with meaningful names is very helpful when writing code and provides documentation. Not all objects need to be re-named All object names should use the three letter abbreviation of the object type Copyright © Don Kussee 1120-Ch2 #53

Copyright © Don Kussee 1120-Ch2 #53 CNS 1120 Chapter 2 Some primary controls Command button - allows user to cause event 32 properties 24 Methods 17 events cmd Form - The window that the user sees 52 properties 21 Methods 31 events frm Label - outputs information to the user 48 properties 10 Methods 18 events lbl Timer - an event based on time 7 properties 0 Methods 1 event tmr Copyright © Don Kussee 1120-Ch2 #53

Copyright © Don Kussee 1120-Ch2 #53 CNS 1120 Chapter 2 Some primary controls Frame - groups controls into a group 34 properties 6 Methods 13 events fra Copyright © Don Kussee 1120-Ch2 #53

Command Button properties CNS 1120 Chapter 2 Command Button properties 32 Properties 24 Methods 17 Events Name - used in code procedures Caption - displayed on the button Picture - displayed on the button Enabled - does it work Visible - can you see it Usual event - Click Copyright © Don Kussee 1120-Ch2 #53

Printing Visual Basic programs CNS 1120 Chapter 2 Printing Visual Basic programs Copyright © Don Kussee 1120-Ch2 #53

Copyright © Don Kussee 1120-Ch2 #53 CNS 1120 Chapter 2 File Names Win95 allows 256 characters Except only ~ ? * : But in DOS mode only 1st 6 letters are used There is an extension Form including controls and code .FRM Changes to controls on the form .FRX Project listing forms and others files .VBP Copyright © Don Kussee 1120-Ch2 #53

Win95 Standard File Extensions CNS 1120 Chapter 2 Win95 Standard File Extensions VBP VB Project FRM VB Form VBX controls on form BAS VB Module CLS VB Class MDB MS Access TXT Generic text EXE Executable DAT Data LOG Recorded event COM Commands BAT Batch BIN Binary BAK Backup JPG Graphics SYS System Copyright © Don Kussee 1120-Ch2 #53

Saving Visual Basic Programs CNS 1120 Chapter 2 Saving Visual Basic Programs Create a folder with a descriptive name In the folder, create a VB program Save the Form, Classes, Code, Resources Save the Project Save frequently Backup often Copyright © Don Kussee 1120-Ch2 #53

Saving Visual Basic Programs CNS 1120 Chapter 2 Saving Visual Basic Programs Copyright © Don Kussee 1120-Ch2 #53

Copyright © Don Kussee 1120-Ch2 #53 CNS 1120 Chapter 2 File type change Copyright © Don Kussee 1120-Ch2 #53

Expanded VP program parts CNS 1120 Chapter 2 Expanded VP program parts Projects - grouping of forms & files & code One and only one project .vbp Zero or more Forms - usually one .frm modification of controls on the form .vbx Zero or more Code modules -often zero .bas Zero or more Class modules -often zero .cls Zero or more Resource files -often zero .res Copyright © Don Kussee 1120-Ch2 #53

Copyright © Don Kussee 1120-Ch2 #53 CNS 1120 Chapter 2 Assignments Lightening 1 Exchange Rate Café Don Lightening 2 Color choice Data types Copyright © Don Kussee 1120-Ch2 #53

Copyright © Don Kussee 1120-Ch2 #53 CNS 1120 Chapter 2 Computer Terms Syntax Semantic Keyword Code Control Object Properties Methods Events Run time error Syntax error Logical error Default value Form lbl Prefix cmd Prefix Empty string Copyright © Don Kussee 1120-Ch2 #53