You are on page 1of 2

Assignment 2

Given below is a form to accept the length and breadth of a rectangle and calculate
the area and perimeter.

Control
Form1
Label1
Text1
Label2
Text2
Command1
Label3
Control
Label4
Label5
Label6
Command2
Command3

Property
Caption
Caption
(Name)
Text
Caption
(Name)
Text
(Name)
Caption
Caption
Property
(Name)
BorderStyle
Caption
Caption
(Name)
BorderStyle
Caption
(Name)
Caption
(Name)
Caption

Value
Area and Perimeter
Enter the Length
TxtLength
Enter the Breadth
txtBreadth
cmdCalculate
Calculate
Area of Rectangle
Value
lblArea
1-FixedSingle
Perimeter is
lblPerimeter
1-FixedSingle
cmdClear
&Clear
cmdQuit
&Quit

Fill in the code below:


(General Declarations)

Dim intLength, intBreadth As Integer


Dim intArea, intPerimeter As Integer
Private Sub cmdCalculate_Click( )
intLength=Val(txtLength.Text)
intBreadth=Val(txtBreadth.Text)
intArea= intLength * intBreadth
intPerimeter=2*( intLength + intBreadth)
lblArea.Caption= intArea
lblPerimeter.Caption= intPerimeter
End Sub
Private Sub cmdClear_Click( )
lblArea.Caption=
lblPerimeter.Caption=
txtLength.Text =
txtBreadth.Text=
End Sub
Private Sub cmdQuit_Click( )

End
End Sub

You might also like