Lets say I have a function like the simple one I have posted below. When I call the function is there a way to call it specifically depending on which variable is given?
I can't really lay out what I mean, best way to say is that I want to direct the amount into different areas of the form depending on what variable is returned to me. If decMealSaved is returned I want it to be added in what is exempt and if decMealCost is returned then I want it to be added in what is owed to the company. I hope I'm getting my point across...Code:Function CalcMeals() As Decimal 'Submit Var values to be used in the function decDays = CDec(cboDays.SelectedItem().ToString) decMeals = CDec(txtMeals.Text.ToString) * decDays decMealA = CDec(conMEALS * decDays) decMealCost = CDec(decMeals - decMealA) decMealSaved = CDec(decMealA - decMeals) 'Determine whether to return what is owed or what is 'reimbursed. If decMeals > decMealA Then Return decMealCost ElseIf decMeals < decMealA Then Return decMealSaved End If End Function
Thanks if you can help.![]()





Reply With Quote