Title: Visual Basic Programming Chapter Six Notes Repetition and the Do Statement
1Visual Basic ProgrammingChapter Six
NotesRepetition and the Do Statement
- ADDING ICONS TO YOUR FORM
- It is possible to add an ______________ to your
title bar by setting the forms
_________________________________. - You can use the NUMEROUS icons that come with
Studio.Net. Of course, if you dont find any that
you like you can always create your own or find
some online. - Ive moved a copy of the icon files that come
with Visual Studio.Net into our class network
space for your convenience. - PROPERTIES OF THE LISTVIEW CONTROL
- __________________________ Determines how items
display in the ListView Control. Switch to
_______________________ if you would like to
display multiple columns. - _________________________ used to add and edit
the Columns in a ListView Control. - You can change the Text Property to give each
column its own heading. - Other settings, like Width, can also be adjusted
if necessary. - _________________________ specifies whether the
user can select multiple items in the list. - _________________________ determines if a check
box appears with each item in the list, so the
user can select multiple items. - ANCHORING CONTROLS
- In previous applications weve developed the
windows used were not resizable during run time. - When a form is resized, controls on the form must
be moved or resized as well in order to maintain
a usable and balanced user-interface.
2Visual Basic ProgrammingChapter Six
NotesRepetition and the Do Statement
- CHECKBOX CONTROL
- The ____________________________________ is used
in applications to allow a user to specify one of
two conditions, such as on or off, yes or no, or
true or false. - In the Todays Sales Check program the checkbox
control was used to input whether an item was on
sale or not. - Some important CheckBox Properties
- ___________________ determines whether the box
is checked or not. Its either True or False. - ___________________ puts text next to the
CheckBox explaining its purpose. - ___________________ Determines the location of
the check box inside of the control. (right of
text, left of text etc..) - DECLARING AN OBJECT AND USING AN OBJECT VARIABLE
- So you have your main form Todays Sales Check
and the user clicks on the button to Enter
Todays Sales. You want to launch the second form
from within the first form. - Well, as is the case with all forms, the Todays
Sales Entry Form is a _____________________,
which means that an instance of the class must be
declared before it can be used. This can be done
with an __________________________________________
. - Use the Dim statement and the ____________________
_____. For example - __________________________________________________
________________________ - DECLARING AN OBJECT AND SHOWING A FORM
- The ____________________ determines whether the
variable contains a complete instance of the
object.
3Visual Basic ProgrammingChapter Six
NotesRepetition and the Do Statement
- REPETITION AND THE DO STATMENT
- One of the most powerful aspects of computer
programming is the capability of performing a set
of operations repeatedly based on certain
conditions. - In programming, the process of repeating a set of
instructions is known as ________________________,
or __________________________. - There are four basic types of loops, two of which
contain the decision to terminate the loop at the
top of the control structure and two which
contain the decision to terminate the loop at the
top of the control structure. - THE DO WHILE STATEMENT
- A common form of the Do statement is the
_______________________. - This statement ___________________________________
_____________________________ ____________________
__________________________________________________
______. - Two examples (one tests at the top of the
structure, one tests at the bottom of the
structure) - ______________________________
________________________________ - _________________________________
___________________________________ - _________________________________
___________________________________ - DO UNTIL STATEMENTS
- Another common form of the Do statement is the
_________________________.
4Visual Basic ProgrammingChapter Six
NotesRepetition and the Do Statement
- WORKING WITH COLLECTIONS
- A ___________________________________ is a group
of one or more objects that can be accessed and
operated on as a single entity. - You have a little bit of experience with
collections. - In Project 5 you used a collection to add items
to your ComboBox. This is using a collection as a
property of a control. - As you learned in Project 5, .NET assigns an
unique __________________________ to each item in
a collection. This will come in handy when
working with a ListView Control. - Before adding items to the ListView Control you
must - Create an object to hold the item
- Then you must put the users input into that
object. - Then you can add that object to the ListView
Control - Finally, you can redisplay the Input Form
- ADDING ITEMS TO A LISTVIEW CONTROL
- __________________ this property always
displays as the first column in the ListView
Control. - ___________________________ If you have more
than one column in a ListView control, a SubItems
collection is created. - Each Item and SubItem has an _____________________
_____________________________ ___________________
___________. - For Example
- lstTodaysSales.Items(0).Text _________________
____
5Visual Basic ProgrammingChapter Six
NotesRepetition and the Do Statement
- EXITING A LOOP PREMATURELY
- It is possible to exit a loop early if necessary.
Just use the ____________________. - Examples are below
- __________________________
- __________________________
- NESTED FOR NEXT LOOPS
- When the statements of one ForNext Loop lie
within the range of another ForNext Loop, the
loops are said to be ________________, or
____________________________. - An example can be seen below
- IMPLEMENTING A LOOP WITH A FORNEXT STATEMENT
- We talked about ForNext Loops being great for
controlled-count loops. Here is a perfect example
from the btnTotalSales in the Chapter 6 Main
Project. This button is used to add to the total
for items on sale and items that werent on sale. - Line 160 sets the intListCount variable to the
number of items in the ListView Control. The
_______________________________________________
of the list box knows exactly how many items are
in the control. So use it! - Line 161 and 163 set up the loop. Obviously well
have to add code between the For and the Next! ? - ACCESSING ITEMS IN A LISTVIEW CONTROL
6Visual Basic ProgrammingChapter Six
NotesRepetition and the Do Statement
- CONCATENATION OPERATORS
- We learned how to concatenate strings in Chapter
Four. - Concatenation Operators are another form of
concatenation. It is used to save you time when
you are typing up expressions. - For Example _____________________
______________ can be written as -
___________________________________ - ______________________________________________ --
used to start a new line within a string. - REMOVING ITEMS FROM A LISTVIEW CONTROL
- It is very easy to clear an entire list box. Just
use the _______________________________. - For example, this code was found inside the
btnClearList click event - __________________________________________________
______ - Other methods such as Remove() or Remove At() can
be used to remove specific items from the list. - KEYBOARD EVENTS
- This program wanted the user to be able to delete
any item from the ListView Control simply by
clicking on the item and then pressing the Delete
key. - In order to do that you would have to set up a
KeyBoard event for the ListView Control. This is
very simple to do!
7Visual Basic ProgrammingChapter Six
NotesRepetition and the Do Statement
- Use the note space below for the following Coding
201 topics - Do While and Do Until Statements
- For Next Statement
- String Manipulation
- Concatenation Operators
- __________________________________________________
_______________
8Visual Basic ProgrammingChapter Six
NotesRepetition and the Do Statement
9Visual Basic ProgrammingChapter Six
NotesRepetition and the Do Statement