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

Slides:



Advertisements
Similar presentations
Using Macros and Visual Basic for Applications (VBA) with Excel
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.
Introduction to Computing Dr. Nadeem A Khan. Lecture 10.
Chapter 5 - Menus, Sub Procedures, and Sub Functions  Menus - controls - properties and events –menu editor - create and change –defining menus - menu.
Introduction to Computing Dr. Nadeem A Khan. Lecture 7.
Introduction to Computing Dr. Nadeem A Khan. Lecture 4.
Introduction to Computing Dr. Nadeem A Khan. Lecture 11.
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.
Copyright 2003 : Ismail M.Romi, PPU. All Rights Reserved 1 Lab2 Managing Controls.
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 Computing Dr. Nadeem A Khan. Lecture 9.
Introduction to Visual Basic. What is Visual Basic? An environment for developing Windows applications Components –A GUI (Graphical User Interface - gooey)
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.
Microsoft Visual Basic 2010: Reloaded Fourth Edition Chapter One An Introduction to Visual Basic 2010.
Chapter 3 Introduction to Event Handling and Windows Forms Applications.
Chapter 8: String Manipulation
Visual Basic Chapter 1 Mr. Wangler.
Introduction to Graphical User Interfaces. Objectives * Students should understand what a procedural program is. * Students should understand what an.
Enhancing User Interaction Through Programming
® Microsoft Access 2010 Tutorial 11 Using and Writing Visual Basic for Applications Code.
CIS 115 Lecture 3.  Forms  Form properties  Controls  Control properties  Event Driven Programming  Form Events  Control Events  Event Handlers.
Chapter 2 More Controls Programming in C#. NET © 2003 by The McGraw-Hill Companies, Inc. All rights reserved.
Chapter 4: The Selection Process in Visual Basic.
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 -
Basic Controls & Properties Chapter 2. Overview u VB-IDE u Basic Controls  Command Button  Label  Text Box  Picture Box u Program Editor  Setting.
Irwin/McGraw-Hill © The McGraw-Hill Companies, Inc., Visual Basic Projects Project Structure and VB’s Programming Tools chapter TWO.
 Application – another name for a program.  Interface – is what appears on the screen when the application is running.  Program Code – is instructions.
Program Design and Coding
Microsoft Visual Basic 2012 CHAPTER THREE Program Design and Coding.
Microsoft Visual Basic 2010 CHAPTER THREE Program Design and Coding.
Microsoft Visual Basic 2005 CHAPTER 4 Variables and Arithmetic Operations.
Introduction It is developed to create software applications. It is a tool for developers of any program that uses both basic and expert settings. It.
Chapter Two Designing Applications Programming with Microsoft Visual Basic th Edition.
Working with the VB IDE. Running a Program u Clicking the”start” tool begins the program u The “break” tool pauses a program in mid-execution u The “end”
Managing Controls Lab 2 2 All Rgihs ReservedIsmail M. Romi – PPu: IT DEpt.
Practical Programming COMP153-08S Week 5 Lecture 1: Screen Design Subroutines and Functions.
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.
McGraw-Hill/Irwin Programming in Visual Basic 6.0 © 2002 The McGraw-Hill Companies, Inc. All rights reserved. Update Edition Chapter 2 More Controls.
VB Objects & Events (Exercises) School of Business Eastern Illinois University © Abdou Illia, Spring 2003 (Week 3, Friday 1/31/2003)
CMPF114 Computer Literacy Chapter 3 The Visual Basic Environment 1.
Introduction to Computing Dr. Nadeem A Khan. Lecture 7.
Chapter 2 More Controls Programming in C#. NET Objectives Use text boxes, group boxes, check boxes, radio buttons, and picture boxes effectively.
Introduction to Computing Dr. Nadeem A Khan. Lecture 9.
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.
IMS 3253: Forms, Controls, Properties, Events 1 Dr. Lawrence West, MIS Dept., University of Central Florida Topics Program Elements Assignment.
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: 
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.
Chapter 10 Using Macros, Controls and Visual Basic for Applications (VBA) with Excel Microsoft Excel 2013.
Microsoft Visual Basic 2010 CHAPTER FOUR Variables and Arithmetic Operations.
Introduction to Computing
Variables and Arithmetic Operations
Introduction to Computing
1. Introduction to Visual Basic
An Introduction to Computers and Visual Basic
Objectives Learn about Function procedures (functions), Sub procedures (subroutines), and modules Review and modify an existing subroutine in an event.
Visual Basic Properties, Methods and Events
Variables and Arithmetic Operations
Visual Basic Programming Chapter Four Notes Working with Variables, Constants, Data Types, and Expressions GROUPBOX CONTROL The _____________________________________.
Visual Basic: Week 5 Review User defined functions
An Introduction to Computers and Visual Basic
Introduction to Programming
3.Visual Basic Controls.
Tutorial 11 Using and Writing Visual Basic for Applications Code
Presentation transcript:

Introduction to Computing Dr. Nadeem A Khan

Lecture 13

► Properties  Name  Max  Min  Value  Large Change  Small Change etc. Scroll Bar (Horizontal and Vertical)

► Events  Change  Scroll etc. Scroll Bar (Horizontal and Vertical) - (Contd.)

► Read about them in the book Timer, Line, Shape

► Try out various formatting commands in the Format Menu the Format Menu The Format Menu

States of Visual Basic Three states of Visual Basic: ► Design State ► Execution State and and ► Break State

States of Visual Basic (Contd.) ► Break State: Execution interrupted temporarily  Press F5 to resume or choose Run > Continue  Immediate Window is activated  Can edit code, Issue commands in the immediate window, Cannot edit the user-interface

► Useful for debugging ► Tryout commands in the break state like:  Print Label1.Caption  Print ( )/5  Label1.Caption= “Hello World”  Picture1.Print “Hello” The Immediate Window

What is Focus ?

► The ability of a control to receive user input ► Related Events  GotFocus  LostFocus ► Related Properties  TabIndex  TabStop Focus

► Related Methods  SetFocus ► The statement Text1.SetFocus‘shift focus to Text1 Text Box => Access Key can also be used to get focus Focus (Contd.)

► Names ► Appearance: (Flat look/3-D look etc.) ► BackColor ► ForeColor ► Font ► Caption ► Text ► Width, Height ► Left, Top VB Objects and Properties

► Enabled: True/False  False: ► Cannot accept user input ► Cannot get focus ► Visible: True/False  False: Control is invisible etc. VB Objects and Properties (Contd.)

Methods are actions that objects can carry out ► Print: e.g:  Picture1.Print  Printer.Print  Form1.Print ► Cls: Contents are discarded e.g:  Picture1.Cls‘ to clear the text in the picture box  Form1.Cls ‘ to clear the text on the form VB Objects and Methods

► Move: For moving and resizing objects e.g:  Control.Move left, top, width, height =>more on Methods in book or use help VB Objects and Methods (Contd.)

Event is a control’s response to an external action ► Change: e.g:  VScroll1_Change (Value property of the Scroll Bar is changed)  Text1_Change (each time a new character is typed in or deleted in the Text Box)  Check1_Change (each time the user changes the status of the Check Box by clicking it VB Objects and Events

► Click, DblClick:  events related to pressing left mouse button ► KeyPress:  Events related to pressing a key VB Objects and Events (Contd.)

► More Events  related to Mouse ► MouseDown, MouseUp, MouseMove etc.  related to keyboard ► KeyDown, Keyup etc. more on Events in book or use help VB Objects and Events (Contd.)

► Event procedures implement the user-response Sub Label1_DblClick( ) Rem An event procedure with no arguments …. End Sub Sub Text1_KeyPress(KeyAscii As Integer) Rem An event procedure with an argument KeyAscii ….. End Sub VB Objects and Events (Contd.)

 Application does not determine the flow; Events caused by the user determine the flow Event-Driven Programming

Object Oriented Programming?

Built-in Functions ► Take one or more input values ► Return an output value ► Already seen:  Val(..), Str$(..), Asc(..), Chr(..)

Built-in Numeric Functions ► Sqr: calculates square-root and returns the value as double data type e.g: e.g:  Sqr(9) is 3  Sqr(0) is 0  Sqr(2) is  Sqr(30*2+4) is 8

Built-in Numeric Functions ► Int: Greatest integer less than and equal to a number e.g: e.g:  Int(2.7) is 2  Int(3) is 3  Int(-2.7) is -3

Built-in String Functions ► Left$, Mid$, Right$, UCase$, Trim$ Left$(“fanatic”, 3) is “fan”Right$(“fanatic”, 3) is “tic” Left$(“12/15/93”,2) is “12”Right$(“12/15/93”, 2) is “93” Mid$(“fanatic”, 5,1) is “t”Mid$(“12/15/93”,4, 2) is “15” Ucase(“Disk”) is “DISK”Ucase(“12two”) is “12TWO” Trim$(“ 1 2 ”) is “1 2”Trim$(“-12 ”) is “-12”

Remember Assignment 4 ► It has been posted: See the Website

Refer to: ► Schneider: Section 3.6 ► Brown: Chapter 3(p76-104; p115-p127)