Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Write the Visual Basic code for a pretest loop that uses an Integer variable nam

ID: 3938764 • Letter: W

Question

Write the Visual Basic code for a pretest loop that uses an Integer variable named intEven to display the even integers from 2 through 20 in the lblEven control. Use the For...Next statement. Display each number on a seperate line in the control. Then create an app;ication to test your code using the following names for the solution and project, respectively: Even Solution and Even Project. Save the application in the VB2015Chap06 folder. Add a button and a label to the interface. Enter your code in the button's Click event procedure, and then test the application appropriately.

Explanation / Answer

Private Sub cmdPrime_Click()
Dim intEven as integer;

Print “even numbers are : ”
For intEven = 2 To 20

If intEven Mod 2 = 0 Then
print intEven
Exit For
Else
print "not even numbers'"
End If


End Sub