In this program we are finding volume using a class.
Code:
Public Class Form1
Public Class Box1
Public l, b, h, vol As Integer
Sub display()
l = Form1.TextBox1.Text
b = Form1.TextBox2.Text
h = Form1.TextBox3.Text
vol = l * b * h
MsgBox("Volume" & vol)
End Sub
End Class
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim s As New Box1
s.display()
End Sub
End Class
Code:
Public Class Form1
Public Class Box1
Public l, b, h, vol As Integer
Sub display()
l = Form1.TextBox1.Text
b = Form1.TextBox2.Text
h = Form1.TextBox3.Text
vol = l * b * h
MsgBox("Volume" & vol)
End Sub
End Class
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim s As New Box1
s.display()
End Sub
End Class
Output: