Visual Basic 'NET BASICS - PowerPoint PPT Presentation

1 / 11
About This Presentation
Title:

Visual Basic 'NET BASICS

Description:

Information is added to a ListBox using the Items.Add method. ... Use a negative value after the Step keyword to count backwards. 6. Nesting For Next Loops ... – PowerPoint PPT presentation

Number of Views:43
Avg rating:3.0/5.0
Slides: 12
Provided by: stephenc9
Category:
Tags: basics | net | basic | method | visual

less

Transcript and Presenter's Notes

Title: Visual Basic 'NET BASICS


1
Visual Basic .NET BASICS
  • Lesson 11
  • List Boxes, For Next Loops, and Label Settings

2
Objectives
  • Use the ListBox control to show multiple lines of
    information.
  • Use For Next loops.
  • Nest For Next loops.
  • Change label font settings.

3
Using the ListBox Control
  • Visual Basic .NET includes the ListBox control,
    which enables you to display a list of items to
    the user.
  • Information is added to a ListBox using the
    Items.Add method.
  • The items added to a ListBox object can be
    removed all at once by using the Items.Clear
    method.

4
Using For Next Loops
  • The For Next loop is specifically designed for
    repeating a block of code a specific number of
    times.
  • A For Next loop always begins with a For
    statement and ends with a Next statement.
  • For Next loops always involve a Counter variable.

5
Using the Step Keyword
  • The Step keyword is used to cause the loop
    counter to count by an increment other than one.
  • Use a negative value after the Step keyword to
    count backwards.

6
Nesting For Next Loops
  • For Next loops can be nested within other For
    Next loops or within Do loops.
  • When you nest For Next loops, each nested loop
    must be completely contained within the outer
    loop.

7
Changing Label Font Settings
  • When you create label controls on forms, you can
    control the font, style, and size using the Font
    property of the label control.
  • You can make labels appear in any font installed
    on your computer.

8
Summary
  • Visual Basic .NET includes a ListBox control for
    displaying lists of information. The Items.Add
    method adds items to a ListBox control. The
    Items.Clear method removes all the entries in a
    ListBox control.
  • A For Next loop is specifically designed for
    repeating a block of code a specific number of
    times.

9
Summary (continued)
  • A For Next loop always begins with a For
    statement and ends with a Next statement. The
    statements between the For and Next statements
    are repeated the number of times specified in the
    For Next loop.
  • For Next loops always involve a Counter variable.

10
Summary (continued)
  • If you want a For Next loop to count by an
    increment other than one, you can use the Step
    keyword. The Step keyword can also be used to
    make a For Next loop count backwards.
  • For Next loops can be nested.

11
Summary (continued)
  • Indenting your code can help make nested For Next
    loops easier to read. You can also use Next
    statements that specify the counter variable of
    the loop.
  • You can use the Font property to change the font,
    style, and size of a label.
Write a Comment
User Comments (0)
About PowerShow.com