Introduction to Computing - PowerPoint PPT Presentation

1 / 28
About This Presentation
Title:

Introduction to Computing

Description:

Print Label1.Caption. Print (1 2 3 4)/5. Label1.Caption= 'Hello World' Picture1.Print 'Hello' The Immediate Window. What is Focus ? ... – PowerPoint PPT presentation

Number of Views:11
Avg rating:3.0/5.0
Slides: 29
Provided by: surajL
Category:

less

Transcript and Presenter's Notes

Title: Introduction to Computing


1
Introduction to Computing
  • Dr. Nadeem A Khan

2
Lecture 13
3
Scroll Bar (Horizontal and Vertical)
  • Properties
  • Name
  • Max
  • Min
  • Value
  • Large Change
  • Small Change
  • etc.

4
Scroll Bar (Horizontal and Vertical)
- (Contd.)
  • Events
  • Change
  • Scroll
  • etc.

5
Timer, Line, Shape
  • Read about them in the book

6
The Format Menu
  • Try out various formatting commands in
  • the Format Menu

7
States of Visual Basic
  • Three states of Visual Basic
  • Design State
  • Execution State
  • and
  • Break State

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

9
The Immediate Window
  • Useful for debugging
  • Tryout commands in the break state like
  • Print Label1.Caption
  • Print (1234)/5
  • Label1.Caption Hello World
  • Picture1.Print Hello

10
What is Focus ?
11
Focus
  • The ability of a control to receive user input
  • Related Events
  • GotFocus
  • LostFocus
  • Related Properties
  • TabIndex
  • TabStop

12
Focus (Contd.)
  • Related Methods
  • SetFocus
  • The statement
  • Text1.SetFocus shift focus to Text1 Text Box
  • gt Access Key can also be used to get focus

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

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

15
VB Objects and Methods
  • 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

16
VB Objects and Methods (Contd.)
  • Move For moving and resizing objects
  • e.g
  • Control.Move left, top, width, height
  • gtmore on Methods in book or use help

17
VB Objects and Events
  • Event is a controls 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

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

19
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

20
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

21
Event-Driven Programming
  • Application does not determine the flow
  • Events caused by the user determine the flow

22

Object Oriented Programming?
23
Built-in Functions
  • Take one or more input values
  • Return an output value
  • Already seen
  • Val(..), Str(..), Asc(..), Chr(..)

24
Built-in Numeric Functions
  • Sqr calculates square-root and returns the value
    as double data type
  • e.g
  • Sqr(9) is 3
  • Sqr(0) is 0
  • Sqr(2) is 1.414214
  • Sqr(3024) is 8

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

26
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

27
Remember Assignment 4
  • It has been posted See the Website

28
Refer to
  • Schneider Section 3.6
  • Brown Chapter 3(p76-104 p115-p127)
Write a Comment
User Comments (0)
About PowerShow.com