Rather than creating your own class to return or having a ByRef parameter for the function I would advise you to split it into 2 functions. Each method should have a single responsibility.
vb.net Code:
Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load Const sqFt = 1000 Dim gal = Gallons(sqFt) Dim cost = RoomPaintCost(gal, 19.95) End Sub Private Shared Function Gallons(squareFeet As Integer) As Decimal Return Math.Ceiling(squareFeet / 115) End Function Private Shared Function RoomPaintCost(gallons As Decimal, paintCost As Decimal) As Decimal Return gallons * paintCost End Function




Reply With Quote