0
How to find the area of rectangle, square and triangle In a vb code
2 ответов
+ 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
0
How to create it in asp.net