You have not specified whether it is Visual Basic 6 or VB.net. In this case, the answers don't make a difference, but the versions will help to give a better context.
1. The format of the for-next loop statement is:
FOR i = start TO finish, [STEP s]
... statements to be executed
NEXT
On entering the loop, if the initial value of finish is greater than start, the statements inside the loop will not be executed at all.
However, if s is specified and is negative, the loop content will not be executed if start is less than finish.
Examples where the loop will not execute are:
FOR i=10 TO -1.... next
FOR k=1 TO 10 STEP -5... next
2. Example:
Here is an actual example from VB.net
Sub keypressed(ByVal o As [Object], ByVal e As KeyPressEventArgs)
If e.KeyChar = Microsoft.VisualBasic.ChrW(13) Or Char.IsDigit(e.KeyChar) Or e.KeyChar = Microsoft.VisualBasic.ChrW(7) Then
e.Handled = True
End If
End Sub 'keypressed
You can modify it according to your requirements for describing how subroutines are implemented.
For a VB6 tutorial:
http://www.vbtutor.net/vbtutor.html
For a VB.net tutorial:
http://www.homeandlearn.co.uk/NET/vbNET.html
(1) state the condition under which a FOR-TO-NEXT loop will not be executed.
(2) With the aid of illustrative example, describe how a subroutine is implemented in BASIC.
2 answers
CIT201: Programming
Assignment 2
--------------------------------------------------------------------------------
Entering Code in Visual Basic
In this assignment, you will finish the project you began last week. Open the Smith Repair Parts Specials program interface.
Code the Project
The description and price of a repair part or service should display to the two TextBox controls with the ReadOnly property = True because the TextBox controls on this form are used for output, not input.
Three Display Buttons: when a button is clicked, the relevant information should display on the form.
The data to be displayed for each of these three buttons are given in the table shown below.
Button
Repair Specials Information
Price
Auto
New Brakes and Calipers
$129.95
Truck
Heavy Duty Tires
$185.50
Commercial
Annual Inspections
$82.49
Include the following:
1. When designing the form, select control names that follow the naming convention specified in the lecture.
2. Include comments before the Public Class declaration that include the PROJECT, PROGRAMMER NAME, and DATE.
3. Include remarks statements inside of each sub procedure to identify what the sub procedure does.
Zip the files and upload into the appropriate dropbox.
This activity will be graded using the Technology Application Grading Rubric - Programming.
Learning Outcome(s): 4
4. Design a program interface and determine the appropriate controls and code.
Assignment 2
--------------------------------------------------------------------------------
Entering Code in Visual Basic
In this assignment, you will finish the project you began last week. Open the Smith Repair Parts Specials program interface.
Code the Project
The description and price of a repair part or service should display to the two TextBox controls with the ReadOnly property = True because the TextBox controls on this form are used for output, not input.
Three Display Buttons: when a button is clicked, the relevant information should display on the form.
The data to be displayed for each of these three buttons are given in the table shown below.
Button
Repair Specials Information
Price
Auto
New Brakes and Calipers
$129.95
Truck
Heavy Duty Tires
$185.50
Commercial
Annual Inspections
$82.49
Include the following:
1. When designing the form, select control names that follow the naming convention specified in the lecture.
2. Include comments before the Public Class declaration that include the PROJECT, PROGRAMMER NAME, and DATE.
3. Include remarks statements inside of each sub procedure to identify what the sub procedure does.
Zip the files and upload into the appropriate dropbox.
This activity will be graded using the Technology Application Grading Rubric - Programming.
Learning Outcome(s): 4
4. Design a program interface and determine the appropriate controls and code.