0% found this document useful (0 votes)
16 views3 pages

CS1 Practical 12

Uploaded by

na4uto10
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
16 views3 pages

CS1 Practical 12

Uploaded by

na4uto10
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 3

12) Write a program in Visual Basic that calculates area and

selection of two shapes, Circle and Rectangle.

To calculate area of selected Shape


FrmShape
Code:-
Private Sub CmdOK_Click()
If (OptCircle.Value = True) Then
FrmCircle.Show
Else
FrmRect.Show
End If
End Sub
Private Sub CmdExit_Click()
End
End Sub
Layout:

FrmCircle
Code:-
Private Sub CmdClear_Click()
Text1.Text = ""
Text2.Text = ""
End Sub
Private Sub CmdExit_Click()
FrmShape.Show
End Sub
Private Sub CmdOK_Click()
Dim r As Double, a As Double
r = Val(Text1.Text)
a = 3.142 * r * r
Text2.Text = a
End Sub

Layout:-

FrmRect
Code:-
Private Sub CmdBack_Click()
FrmShape.Show
End Sub
Private Sub CmdClear_Click()
Text1.Text = ""
Text2.Text = ""
Text3.Text = ""
End Sub
Private Sub CmdOK_Click()
Dim l, b, a As Double
l = Text1.Text
b = Text2.Text
a=l*b
Text3.Text = a
End Sub
Layout:-

You might also like