Practical Programming COMP153-08S Week 5 Lecture 1: Screen Design Subroutines and Functions.

Slides:



Advertisements
Similar presentations
Working with Intrinsic Controls and ActiveX Controls
Advertisements

Objectives Understand the software development lifecycle Perform calculations Use decision structures Perform data validation Use logical operators Use.
Chapter 2: Designing Applications
Creating an OOED Application
Chapter 7: Sub and Function Procedures
1.
Chapter 5 Menus, Common Dialog Boxes, Sub Procedures, and Function Procedures Copyright © 2011 by The McGraw-Hill Companies, Inc. All Rights Reserved.
Writing General Procedures Often you will encounter programming situations in which multiple procedures perform the same operation This condition can occur.
1.
IS 1181 IS 118 Introduction to Development Tools VB Chapter 03.
Chapter 5 - Menus, Sub Procedures, and Sub Functions  Menus - controls - properties and events –menu editor - create and change –defining menus - menu.
Lec6 P 1 CP2030 Visual Basic For C++ programmers Copyright © University of Wolverhampton CP2030 VBFC Lecture 6 Back To Index v Procedures and Parameters.
Introduction to Computing Dr. Nadeem A Khan. Lecture 13.
Compunet Corporation Programming with Visual Basic.NET GUI Week # 11 Tariq Ibn Aziz.
Chapter 3 Planning Your Solution
The Project AH Computing. Functional Requirements  What the product must do!  Examples attractive welcome screen all options available as clickable.
Microsoft Visual Basic 2005 CHAPTER 8 Using Procedures and Exception Handling.
Tutorial 7: Sub and Function Procedures1 Tutorial 7 Sub and Function Procedures.
Visual Basic Fundamental Concepts. Integrated Development Enviroment Generates startup form for new project on which to place controls. Features toolbox.
Microsoft Visual Basic 2012 Using Procedures and Exception Handling CHAPTER SEVEN.
Microsoft Visual Basic 2008 CHAPTER 8 Using Procedures and Exception Handling.
Chapter 6 Understanding the Structure of an Application: Procedures, Modules, and Classes.
5-1 aslkjdhfalskhjfgalsdkfhalskdhjfglaskdhjflaskdhjfglaksjdhflakshflaksdhjfglaksjhflaksjhf.
Introduction to Visual Basic. Quick Links Windows Application Programming Event-Driven Application Becoming familiar with VB Control Objects Saving and.
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.
Tutorial 111 The Visual Studio.NET Environment The major differences between Visual Basic 6.0 and Visual Basic.NET are the latter’s support for true object-oriented.
Microsoft Visual Basic 2005: Reloaded Second Edition Chapter 2 Creating a User Interface.
Introduction to Visual Basic.NET Chapter 2 Introduction to Controls, Events.
Chapter 2 - More Controls More controls – Text boxes - used for user input – Frames - containers to group items – check boxes - user select an option -
Visual Basic.NET Comprehensive Concepts and Techniques Chapter 7 Using Menus, Common Dialogs, Procedures, Functions, and Arrays.
Lecture 5(b), Slide 1 CP2030 Copyright © University of Wolverhampton CP2030 Visual Basic for C++ Programmers v Component 5(b) HCI aspects of VB programming.
Chapter One An Introduction to Visual Basic 2010 Programming with Microsoft Visual Basic th Edition.
Microsoft Visual Basic 2005 CHAPTER 4 Variables and Arithmetic Operations.
Programming Test #1 Solutions. Multiple Choice 1. B) the grammar of the coding language 2. C) String 3. A) Single 4. C) 2Burgers4Me 5. B) Design Time.
110-G1 Motivation: Within a program, may have to perform the same computation over and over Many programs share the same computation (e.g. sorting) To.
University of Sunderland CIF 102/FIF102 Fundamentals of DatabasesUnit 15 Programming in Microsoft Access using VBA Using VBA to add functionality.
Chapter Two Creating a First Project in Visual Basic.
1 Creating Windows GUIs with Visual Studio. 2 Creating the Project New Project Visual C++ Projects Windows Forms Application Give the Project a Name and.
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.
Copyright © 2010 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Starting Out with Programming Logic & Design Second Edition by Tony Gaddis.
Copyright (c) 2003 by Prentice Hall Provided By: Qasim Al- ajmi Chapter 3 Some Visual Basic Controls and Events Visual Basic. NET.
CMPF114 Computer Literacy Chapter 3 The Visual Basic Environment 1.
Creating Menus Menu Bar – behaves like standard Windows menus Can be used in place of or in addition to buttons to execute a procedure Menu items are controls.
BBT 10 Visual Basic 03 Enrichment. Tip Before creating any files for your project, first create a new folder Save all of your files in the folder Pieces.
Copyright (c) 2003 by Prentice Hall Provided By: Qasim Al-ajmi Chapter 2 Introduction to Visual Basic Programming Visual Basic.NET.
Programming Logic and Design Fourth Edition, Comprehensive Chapter 14 Event-Driven Programming with Graphical User Interfaces.
Visual Basic Review LBS 126. VB programming Project Form 1Form 2Form 3 Text boxButton Picture box Objects Text box Button Objects.
Microsoft Visual Basic 2012 CHAPTER FOUR Variables and Arithmetic Operations.
Visual Basic.NET Programming for the Rest of Us Keith Mulbery Utah Valley State College.
National Diploma Unit 4 Introduction to Software Development Procedures and Functions.
Microsoft Visual C# 2010 Fourth Edition Chapter 3 Using GUI Objects and the Visual Studio IDE.
Subroutines (PrArith, Math,projCP1, PrAdrProc, PrAdrProcFunc) Please use speaker notes for additional information!
Microsoft Visual Basic 2012: Reloaded Fifth Edition Chapter One An Introduction to Visual Basic 2012.
COMPREHENSIVE Excel Tutorial 12 Expanding Excel with Visual Basic for Applications.
Sub Procedures and Functions Visual Basic. Sub Procedures Slide 2 of 26 Topic & Structure of the lesson Introduction to Modular Design Concepts Write.
Menu & Clipboard Menu Cut / Copy / Paste. Menus Created in the Menu Editor Can contain menu titles, menu items, separator bars, submenu titles, and submenu.
Visual Basic I Programming
Visual Basic Fundamental Concepts
A variable is a name for a value stored in memory.
Chapter Topics 15.1 Graphical User Interfaces
Using Procedures and Exception Handling
Variables and Arithmetic Operations
VISUAL BASIC.
Visual Basic..
Department Array in Visual Basic
CS285 Introduction - Visual Basic
Chapter 15: GUI Applications & Event-Driven Programming
Language Constructs Construct means to build or put together. Language constructs refers to those parts which make up a high level programming language.
Visual C# - GUI and controls - 1
Presentation transcript:

Practical Programming COMP153-08S Week 5 Lecture 1: Screen Design Subroutines and Functions

Core VB steps 1.Design an interface (create paper prototype) 2.Turn this design into a VB form 3.Code events to occur 4.Test and debug

Screen Design

Step 1: Create a Paper Prototype Get a piece of paper and pencil Sketch the user interface display boundaries Sketch on the input areas Sketch on the output areas Sketch on the interactive elements (e.g. buttons) Sketch on any information areas Scribble notes onto design to explain each part of the sketch

Have a go… Design a single form application interface that allows a user to convert currencies –Take a piece of paper… that’s the interface form –Sketch the overall shape of the interface form input, output, interactive (button) areas any information areas –Scribble some notes to say what controls do…

Core VB steps 1.Design an interface (sketch paper prototype) 2.Turn this design into a VB form 3.Code events 4.Test and debug 1.Design an interface (sketch paper prototype) 2.Turn this design into a VB form 3.Code events 4.Test and debug

Step 2: Turning design into a form Place controls onto a VB form –Input areas (e.g. textboxes, check box, radio button, list box) –Output areas (e.g. labels, pictures, lines,) –Information areas (e.g. labels, progressive bar) –Interactive elements (e.g. command buttons, menu items) Arrange the layout & size of controls –Information should flow vertically or horizontally –Top → Bottom, Left → Right (similar to reading a book) –Most important information at top left Edit the properties of a control –E.g. name and text contents –Access Keys –Tab Index Properties

Step 2: Turning design into a form

Qualities of a Good Programmer Correct scope is used Accurate & consistent naming Code is documented well Code is broken into modules Code is in logical sequence Correct selection structures are used

Structured Programming This is about building blocks of code

Structured Programming Simple Sequence Lines of codes to undertake tasks

Structured Programming Control Structure e.g. selection Lines of codes to undertake tasks If condition Then Lines of codes to undertake tasks Else Lines of codes to undertake tasks EndIf Lines of codes to undertake tasks

Structured Programming Control Structure e.g. repetition Lines of codes to undertake tasks Do While condition Lines of codes to undertake tasks Loop Lines of codes to undertake tasks

Structured Programming Form Event Procedures Click on Clear Button Lines of codes to undertake tasks Enter Text into Text Box Lines of codes to undertake tasks Click on Calculate Button Lines of codes to undertake tasks Do While condition Lines of codes to undertake tasks Loop Lines of codes to undertake tasks Click on Exit Button Lines of codes to undertake tasks

Structured Programming Form Level Entry Form Enter Text into Text Box Lines of codes to undertake tasks Click on Exit Button Lines of codes to undertake tasks Calculate Form Click on Clear Button Lines of codes to undertake tasks Enter Text into Text Box Lines of codes to undertake tasks Click on Exit Button Lines of codes to undertake tasks Display Form Click on Clear Button Lines of codes to undertake tasks Click on Exit Button Lines of codes to undertake tasks

Structured Programming Event Procedure/User Procedure Click on ThrowIt Button Lines of codes to undertake tasks Enter Text into Entry Box Lines of codes to undertake tasks Click on Result Button Lines of codes to undertake tasks User Defined Procedure Lines of codes to undertake tasks

User Defined Procedures Two purposes 1.To execute a block of code (User Defined) Sub Procedure 2.To execute code and return a result Function Procedure

these are given a name look very similar to an event Procedure activated using the Call command line of code Call CalcTimeOfDay line of code Private Sub CalcTimeOfDay() lines of code End Sub 1. User Defined Sub Procedure

2. Function Procedure these are given a name look very similar to an event Procedure usually activated with the "=" assignment character line of code IntTotalSpeed = CalculateSpeed () line of code Private Function CalculateSpeed() As Integer lines of code Return SomeValue End Function

Passing Variables

There are two ways we can pass data in the form of variables, in and out of sub routines/functions 1.Passing By Value ByVal –Sub routine gets a copy of the variable –Variable’s original value is not altered 2.Passing By reference ByRef –Sub routine is told variable location (reference) –Variable’s original value is altered

Passing Variables Private Sub YoyoPause (By Ref strYoTime As String) lines of code End Sub Private Function SpeedCalculate(ByVal intSpeedTot as Integer) As Integer lines of code Return SomeValue End Function

THE END of the lecture