Some new stuff:

 

1.  A do loop repeats a sequence of statements a number of times.  A do loop is useful for counting, for a password checker, for entering data until a condition is not true, etc.

 

Here is an example:

 

        Do While Val(txtCount.Text) <= 100

            txtCount.Text = Val(txtCount.Text) + 1

        Loop

 

In the above example, the text will count to 100 then stop.  We need the Do while command, and the loop command for this to work (Loop is put in automatically).

 

2.  We can change the icon in a form.  To do so, search for *.ico using the Start, Search command in Windows.  Then, with the form selected, go to Properties and Icon in Visual Basic and choose the icon that you found and liked using the search command.  After we change the icon, we might get an error when we run the program, we need to just right click on the project, choose properties, then chose the form we want to load first, under Startup Object.

 

Assignment 1, Do While Program

Write a program with a command button.  When you press the command button, an input box will ask you for a password.  Remember, an inputbox has a variable in front of it.  You will enter a password, and if it is incorrect, you will have to try again.  If it is correct, a secret will display in a messagebox, as below:

 

The button says, “Enter the password.”  The inputbox says, “Enter a password.”

 

*Be sure to include a new icon on the form.

*Don’t show it to me yet.

 

 

 

 

 

 

 

 

 

 

 

More new stuff:

You can make a do until loop also.  An example is as follows:

 

Do Until Val(txtCount.Text) >= 100

            txtCount.Text = Val(txtCount.Text) + 1

        Loop

 

This will do almost the same thing as the do while loop, the do until loop will count up to 101. 

 

Assignment #1.5

Add a command button to your program, and make it do the same thing, with a do until loop.

 

 

 

*show me the program at this point.

 

Part 2

Come up with a new program with a do while loop or a do until loop.  The program can not be a password program and must have a command button and something else from the toolbox.