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.
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.
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.
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.
Download as DOCX, PDF, TXT or read online from Scribd
Download as docx, pdf, or txt
You are on page 1of 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