How to find the area of rectangle, square and triangle In a vb code | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

How to find the area of rectangle, square and triangle In a vb code

7th Jul 2017, 12:55 PM
Paramita Sinha
Paramita Sinha - avatar
2 Answers
+ 2
Here's how it's done, I've added notes on return value, if you use VB.Net use the statement with "Return ...". VB6 (VB classic) returns value by assigning return value into function's name. ' Rectangle Function RectangleArea(Width As Double, Height As Double) As Double 'Vb classic RectangleArea = Width * Height 'Vb.net Return Width * Height End Function ' Square Function SquareArea(SideLength As Double) As Double 'Vb classic SquareArea = SideLength ^ 2 'Vb.net Return SideLength ^ 2 End Function ' Triangle Function TriangleArea(BaseLength As Double, VerticalHeight As Double) As Double 'Vb classic TriangleArea = 0.5 * (BaseLength * VerticalHeight) 'Vb.net Return 0.5 * (BaseLength * VerticalHeight) End Function
8th Jul 2017, 10:15 AM
Ipang
0
How to create it in asp.net
29th Sep 2020, 7:45 AM
ROJA K
ROJA K - avatar