The document contains code snippets from multiple classes that demonstrate different ways to perform calculations based on user input from text boxes and display the results in labels. The code samples calculate area of a square, volume of a cube, integer division and modulo, and area of a circle based on radius. User input is obtained from text boxes and results are displayed using labels after calculations with variables for length, width, radius, etc.
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0 ratings0% found this document useful (0 votes)
45 views2 pages
Chapter 3 Review
The document contains code snippets from multiple classes that demonstrate different ways to perform calculations based on user input from text boxes and display the results in labels. The code samples calculate area of a square, volume of a cube, integer division and modulo, and area of a circle based on radius. User input is obtained from text boxes and results are displayed using labels after calculations with variables for length, width, radius, etc.
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 2
Chapter 3 Review
Public Class Form1
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click Dim side As Integer = 5 Dim area As Integer area = side * side Label2.Text = area End Sub End Class Public Class Form1 Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click Dim side As Integer Dim area As Integer side = Val(TextBox1.Text) area = side * side Label1.Text = area End Sub Private Sub TextBox1_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TextBox1.TextChanged Label1.Text = "" End Sub End Class Public Class Form1 Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click Dim side As Integer side = Val(TextBox1.Text) side = side * side / 2 Label3.Text = side End Sub End Class Public Class Form1 Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click Dim length As Double length = Val(TextBox1.Text) length = length * length * length Label3.Text = length End Sub
Private Sub TextBox1_TextChanged(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles TextBox1.TextChanged Label3.Text = "" End Sub End Class
Public Class Form1
Dim x As Integer = 10 Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click Dim x As Integer = 3 Label2.Text = x End Sub Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click Label2.Text = x End Sub End Class Public Class Form1 Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click Dim x As Integer x = TextBox1.Text x=x\3 Label2.Text = x Dim y As Integer y = TextBox1.Text y = y Mod 3 Label3.Text = y End Sub
Public Class Form1
Const PI As Double = 3.14 Dim x As Double Dim Radius As Double Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click Radius = TextBox1.Text x = PI * Radius ^ 2 Label2.Text = x End Sub End Class