Introduction to Computing Dr. Nadeem A Khan. Lecture 7.

Slides:



Advertisements
Similar presentations
VISUAL BASIC Visual Basic is derived from the Basic language (Beginner’s All-Purpose Symbolic Instruction Code) Visual Basic uses an event-driven programming.
Advertisements

Introduction to Visual Basic Programming. Lecture Outline History What is Visual Basic First Look at the VB 6.0 Environment Some VB Terminology Our first.
Fundamentals of Programming in Visual Basic
Introduction to Computing Dr. Nadeem A Khan. Lecture 21.
Introduction to Computing Dr. Nadeem A Khan. Lecture 22.
Introduction to Computing Dr. Nadeem A Khan. Lecture 8.
Introduction to Computing Dr. Nadeem A Khan. Lecture 10.
The number of calories burned per hour by cycling, jogging and swimming are 200, 475 and 275 respectively. A person loses 1pound of weight for each 3500.
Chapter 5 - Menus, Sub Procedures, and Sub Functions  Menus - controls - properties and events –menu editor - create and change –defining menus - menu.
CVEV 118/698 Visual Basic Lecture 1 Prof. Mounir Mabsout Expert 1: Elsa Sulukdjian Expert 2: Walid El Asmar.
Chapter 3 (ctd) Section 3.2 EVENTS. Three stages in the creation of a Visual Basic program: zCreate the interface yie, choose & create the objects zSet.
Introduction to Computing Dr. Nadeem A Khan. Lecture 4.
Introduction to VB prepared by Dr. I A Moneim Reference Book Schneider.
Introduction to Computing Dr. Nadeem A Khan. Lecture 4.
Introduction to Computing Dr. Nadeem A Khan. Lecture 24.
Introduction to Computing Dr. Nadeem A Khan. Lecture 17.
Introduction to Computing Dr. Nadeem A Khan. Lecture 19.
Introduction to Computing Dr. Nadeem A Khan. Lecture 11.
Introduction to Computing Dr. Nadeem A Khan. Lecture 7.
Introduction to Computing Dr. Nadeem A Khan. Lecture 14.
Introduction to Computing Dr. Nadeem A Khan. Lecture 11.
Introduction to Computing Dr. Nadeem A Khan. Lecture 6.
Introduction to Computing Dr. Nadeem A Khan. Lecture 13.
Introduction to Computing Dr. Nadeem A Khan. Lecture 18.
Section Schneider zThis section introduces nice ways to produce input & display output: yInput boxes yMessage boxes.
Lec2 P 1 CP2030 Visual Basic For C++ Programmers Copyright © University of Wolverhampton CP2030 VBFC Lecture 2 Back to Index v Basic Data Types v Arithmetic.
Introduction to Computing Dr. Nadeem A Khan. Lecture 8.
Introduction to Computing Dr. Nadeem A Khan. Lecture 9.
Introduction To Visual Basic 6. Announcements  Thursday, Oct 9th, 7:30PM, C106 Lloyd Douglas (NSF) Diversity in Science-Who needs it? 5 extra credits.
Copyright © 2001 by Wiley. All rights reserved. Chapter 3: Variables, Assignment Statements, and Arithmetic Variables Assignment Statements Arithmetic.
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.
® Microsoft Access 2010 Tutorial 11 Using and Writing Visual Basic for Applications Code.
© 2006 Lawrenceville Press Slide 1 Chapter 3 Visual Basic Interface.
 Application – another name for a program.  Interface – is what appears on the screen when the application is running.  Program Code – is instructions.
Outline Software and Programming Program Structure Tools for Designing Software Programming Languages Introduction to Visual Basic (VBA)
Introduction to Computing Dr. Nadeem A Khan. Lecture 10.
Chapter 5 - VB 2005 by Schneider1 Chapter 5 – Decisions 5.1 Relational and Logical Operators 5.2 If Blocks.
Introduction to Visual Basic Programming. Introduction Simple Program: Printing a Line of Text Another Simple Program: Adding Integers Memory Concepts.
Practical Programming COMP153-08S Week 5 Lecture 1: Screen Design Subroutines and Functions.
1 Scripting Languages VBScript - Recognized mainly by Internet Explorer only - Netscape does have a plug-in JavaScript - Recognized by Internet Explorer.
Introduction to Computing Dr. Nadeem A Khan. Lecture 7.
110 E-1 Variables, Constants and Calculations(2) Chapter 3: Operations on variables, scope of a variable, formatting data Doing Arithmetic.
Introduction to Computing Dr. Nadeem A Khan. Lecture 9.
Chapter 31 Fundamentals of Programming in Visual Basic (VB) Visual Basic Events Simple Statement.
CHAPTER THREE Representing Data: Constants and Variables.
Visual Basic Review LBS 126. VB programming Project Form 1Form 2Form 3 Text boxButton Picture box Objects Text box Button Objects.
Loop and repetition. Today Passing values to and back from Sub procedures Option Buttons Do While Loops For Loops Population Growth.
Visual Basic A Quick Tutorial VB Review for ACS 367.
COMPREHENSIVE Access Tutorial 11 Using and Writing Visual Basic for Applications Code.
Data and variables in Visual Basic. Annoucement Lecture on Thursday 7:30PM C106 Visual Basic download: 
Chapter 31 Fundamentals of Programming in Visual Basic (VB) Visual Basic Events Simple Statement.
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.
Programming with Visual Basic.NET. Quick Links Program Code The Code Window The Event Procedure Assignment Statements Using AutoList Radio Buttons Buttons.
1 09/10/04CS150 Introduction to Computer Science 1 What Actions Do We Have Part 2.
Representing Data: Constants and Variables
Introduction to Computing Dr. Nadeem A Khan. Lecture 24.
Introduction to Computing Dr. Nadeem A Khan. Lecture 21.
Introduction To Visual Basic 6
VISUAL BASIC 6.0 Designed by Mrinal Kanti Nath.
Visual Basic.NET Windows Programming
Introduction to Computing
Please use speaker notes for additional information!
Chapter 2 Visual Basic Interface
Objectives Learn about Function procedures (functions), Sub procedures (subroutines), and modules Review and modify an existing subroutine in an event.
Midterm Exam Preperation
CS285 Introduction - Visual Basic
Introduction to Programming
Tutorial 11 Using and Writing Visual Basic for Applications Code
Presentation transcript:

Introduction to Computing Dr. Nadeem A Khan

Lecture 7

Announcement ► New TAs Harris Mukarram Mubashir Amjad Hunain ► Visit the Website for their office hours

How to make our user-interface do something?

Visual Basic Events ► Event : Action taken by the user e.g.  Clicking a Control  Double Clicking a Control  Getting Focus  Losing Focus etc. etc.

Visual Basic Events (Contd.) ► Naming of Events  Clicking a Command Button 1 ► Command1_Click  Double Clicking a Picture Box 2 ► Picture2_DblClick  Text box 1 gets Focus ► Text1_GotFocus  Text box 1 loses Focus ► Text1_LostFocus

Visual Basic Events (Contd.) ► Names of events => objectName_event ► Events are pre-defined

Event Procedure ► Event Procedure: block of code to be executed when an event occurs ► General form Sub objectName_event() statements End Sub

Event Procedure (Contd.) ► E.g: Sub Command1_Click() statements End Sub Sub Text1_GotFocus() statements End Sub

Statements?

VB Statements ► Statements to change the properties of an object the general form: the general form: Let objectName.property = setting

Statements (Contd.) Let objectName.property = setting E.g: Let Text1.FontSize = 12 Let Text1.FontBold = TRUE Let Text1.Text = “ ”

Event Procedure (Contd.) ► Event procedure – general form Sub objectName_event() statements End Sub ► Example Sub Command1_Click() Let Text1.text = “” Let Text2.text=“Hello” End Sub

Viewing Code Margin Indicator Bar Procedure View Full Module View Object Box Procedures List Box Split Bar

Methods ► Another category of statements based on methods

Methods (Contd.) ► E.g:  Picture1.Cls Clears Picture1 Picture Box  Picture1.Print 3 Prints ‘3’ in the Picture1 Picture Box Prints ‘3’ in the Picture1 Picture Box

Methods (Contd.) ► General form of these statements => objectName.Method parameters (if any)

The Print Method ► Picture1.Print m? ► Picture1.Print m; ? ► Picture1.Print m; n; r ? m, n, r are numbers e.g. 3, 5.2 m, n, r are numbers e.g. 3, 5.2

Numbers ► Numeric Constants  2, 5.6, 9, ► Arithmetic Operations  Addition (2+3)  Subtraction (2-3)  Multiplication (2*3)  Division (2/3)  Exponentiation (2^3)

Numbers (Contd.) ► Numeric Expressions e.g.  (2+3)/5  (5+2) * (2- 10/2)  2.5*2-3^2+14/7

Numbers (Contd.) ► How will this be calculated?  2+10/5  5+2* 2- 1/10  4*6-3^2+5/10  3^2*5

Numbers (Contd.) ► Operator Precedence 1. ^ 2.- operator (indicating a negative value) 3. * and / operator 4. + and - operator

Numbers (Contd.) ► Use parenthesis ( ) to keep intentions clear (2+2)*2? (2+2)*2? 2+2*2? 2+2*2? (5+ (5*2))/(2+1) ? (5+ (5*2))/(2+1) ?

Strings ► E.g:  “hello”  “9/17/95”  “2+3”

What will be printed? ► Picture1.Print 2*3+2 ► Picture1.Print “hello” ► Picture1.Print “2*3+2”

► David Schneider:  Chapter 3: Section 3.2 Today’s Lecture was based on ► Scott Warner:  Chapter 2: Section 2.1(p48-p50)  Chpater5: Section 5.2