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

Lab Exercise 9 OOP (Inheritance and Polymorphism)

The document contains the code for a Visual Basic form that calculates the area of a circle or cylinder. It includes subroutines to calculate area when buttons are clicked by getting radius and height values from text boxes, clear the text boxes, and handle text changed events for the text boxes. The form uses a Circle class object to perform the calculations.

Uploaded by

Pabbura_Hati
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)
400 views

Lab Exercise 9 OOP (Inheritance and Polymorphism)

The document contains the code for a Visual Basic form that calculates the area of a circle or cylinder. It includes subroutines to calculate area when buttons are clicked by getting radius and height values from text boxes, clear the text boxes, and handle text changed events for the text boxes. The form uses a Circle class object to perform the calculations.

Uploaded by

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

QUESTION 1 CODING FOR FORM:

Public Class Form1 Dim obj As New Circle Dim r As Integer Dim h As Integer Private Sub btnCylinder_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnCylinder.Click With obj r = txtRadius.Text h = txtHeight.Text txtKeputusan.Text = Val((2 * 3.142) * r * h) End With End Sub Private Sub btnCircle_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnCircle.Click With obj r = txtRadius.Text h = txtHeight.Text txtKeputusan.Text = Val(3.142 * r * r) End With End Sub Private Sub btnClear_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnClear.Click With obj txtRadius.Text = "" txtHeight.Text = "" txtKeputusan.Text = "" End With End Sub Private Sub Label3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Label3.Click End Sub Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load End Sub Private Sub txtRadius_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles txtRadius.TextChanged End Sub Private Sub txtHeight_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles txtHeight.TextChanged End Sub Private Sub txtKeputusan_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles txtKeputusan.TextChanged End Sub End Class

INTERFACE OUTPUT:

You might also like