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

Exercise 4

This Visual Basic code defines a class with a button click event handler. It uses two While loops to generate and display sequential numbers from 100 to 125. The first loop simply displays each number on a new line. The second extracts the individual digits of each number and displays them spaced out on new lines. The output of both loops is assigned to separate labels for display.

Uploaded by

api-308657631
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
39 views

Exercise 4

This Visual Basic code defines a class with a button click event handler. It uses two While loops to generate and display sequential numbers from 100 to 125. The first loop simply displays each number on a new line. The second extracts the individual digits of each number and displays them spaced out on new lines. The output of both loops is assigned to separate labels for display.

Uploaded by

api-308657631
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 1

Public Class Form1

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)


Handles Button1.Click
Dim number As Integer = 100
Dim last As Integer = 125
Label4.Text = number.ToString + vbNewLine

While number <= last


Dim num As Integer = number + 1
Label4.Text = Label4.Text + num.ToString + vbNewLine
number = number + 1
End While
number = 100
While number <= last
Label5.Text = Label5.Text + number.ToString.Substring(0, 1) + " "+
number.ToString.Substring(1, 1) + " " + number.ToString.Substring(2) + vbNewLine
number = number + 1
End While

Label6.Text = Label4.Text
End Sub
End Class

You might also like