Visual Basic: Week 5 - PowerPoint PPT Presentation

1 / 8
About This Presentation
Title:

Visual Basic: Week 5

Description:

Visual Basic development includes. Placing controls on the form ... Properties can be changed at Design time and by code during Run time. ... – PowerPoint PPT presentation

Number of Views:36
Avg rating:3.0/5.0
Slides: 9
Provided by: jeanin7
Category:
Tags: basic | visual | week

less

Transcript and Presenter's Notes

Title: Visual Basic: Week 5


1
Visual Basic Week 5
  • Review
  • User defined functions
  • Busy wait versus Timers
  • Homework read chapter 4. Acquire images for
    cards. Will work on Memory in class.

2
Review
  • Visual Basic development includes
  • Placing controls on the form
  • Textbox, label, command button, list box, image
    control
  • Control arrays of any type control
  • Writing code for event procedures
  • Form_Load, command button Click, list box Click

3
Code
  • Assignment statements
  • target expression
  • If/Then/Else
  • Select Case
  • For/Next

4
Built-in functions
  • Int
  • Randomize, Rnd
  • Str
  • Val
  • Format

5
Event procedures
  • Also known as event handlers
  • Visual Basic defines them.
  • Defines the header.
  • Visual Basic invokes them when an event happens.
  • You write the code to do somethingwhat you want
    to happen when a specific event occurs.
  • You write the code in the code window, which you
    get to by double clicking on the specific
    control.

6
Controls
  • Each control type has its own set of properties
  • All control types have (name)
  • Many have position properties
  • Left, Top
  • Form, command button and Label have Caption
  • Textbox has Text (can be changed by player)
  • Command button (also Timer) has Enabled.
  • Many have Visible.
  • Image has Picture.
  • Properties can be changed at Design time and by
    code during Run time.

7
Control array event procedure
  • Suppose lblCards is an array of label controls
  • The event procedure for clicking on any of the
    elements of the control array is
  • Sub lblCards_Click(Index as Integer)
  • Where Index will hold the index for the specific
    element clicked. You use Index in your code.
    For example, you will use this in Memory.

8
Creating a User-Defined Procedure
  • A user defined procedure is one in which you
    define (author) the header as well as write the
    code.
  • User defined procedures can be functions or
    subroutines, meaning they can return values or
    not.
  • Call setupcards
  • If hittarget(x,y) then
  • You write the user defined procedure in the code
    window.
Write a Comment
User Comments (0)
About PowerShow.com