Wednesday, September 18, 2019

HOW TO CALCULATE AREA OF RECTANGLE USING VB PROGRAMMING.

Hi Friends Today i will show you how you can be Calculate Area of Rectangle in VB(Visual Basic 6.0)


  • To Calculate Area of Rectangle you need to insert Two Label Control's.
  • And another Control's need to insert is  Two Text box Control.
  • One Command button is placed to the form.
  • As Shown in Picture Arrange it.
  • The Second Label for Output or Display of Calculate Area of Rectangle. 
  • In this Example I used default names of Control.  
  • Also we concatenate the Strings value to show proper Output in Label Control. 

Coding of Area of Rectangle

Private Sub cmdClick_Click()
Dim l As Integer, w As Integer
Dim area As Double
l = Val(Text1.Text)
w = Val(Text2.Text)
area = l * w
Label3.Caption = "Area of Rectangle is " & area
End Sub

Code Window

Output View
Design View




1 comment: