0% found this document useful (0 votes)
191 views

Chapter 6 Knowledge Check

Program that will calculate the sum of numbers 1-100. BtnCalculate_Click returns the sum of intnumber and intsum. Program uses For loop to calculate the number of entries in a list.

Uploaded by

Lisa Wilson Lane
Copyright
© Attribution Non-Commercial (BY-NC)
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
191 views

Chapter 6 Knowledge Check

Program that will calculate the sum of numbers 1-100. BtnCalculate_Click returns the sum of intnumber and intsum. Program uses For loop to calculate the number of entries in a list.

Uploaded by

Lisa Wilson Lane
Copyright
© Attribution Non-Commercial (BY-NC)
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 2

1. strTemperature = InputBox(strInputBoxMessage & intNumberOfEntries, _ strInputBoxHeading, "12.50") 2.

Program with For Next Loop that will calculate the sum of numbers 1-100 a. Public Class frmcount Private Sub btnCalculate_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnCalculate.Click Dim intsum As Integer Dim intnumber As Integer intSum = 0 For intnumber = 1 To 100 intsum = intsum + intnumber Me.ListBox1.Items.Add("Count " & intnumber & " Total: " & intsum) Me.Label1.Text = "Total " & intsum Next intnumber End Sub End Class b. Public Class frmcount Private Sub btnCalculate_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnCalculate.Click Dim intsum As Integer Dim intnumber As Integer For intnumber = 10 To 50 Step 2 intsum = intsum + intnumber Me.ListBox1.Items.Add("Count " & intnumber & " Total: " & intsum) Me.Label1.Text = "Total " & intsum Next intnumber End Sub c. Public Class frmcount Private Sub btnCalculate_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnCalculate.Click Dim intsum As Integer Dim intnumber As Integer For intnumber = 20 To 60 Step 10 intsum = intsum + intnumber

Me.ListBox1.Items.Add("Count " & intnumber & " Total: " & intsum) Me.Label1.Text = "Total " & intsum Next intnumber End Sub End Class 5. the ampersand(&) is important to concatenate strings 7. Me.lstFavoriteTeam.Items.Add("Your favorite tema is" & intfavoritetema ) 9.IntCounter - = 4.5 11.

You might also like