by Dinesh Thakur Category: Menus Procedure and Function

While writing a Function procedure you must set up a return value. This return value is placed in the a variable that Visual Basic names the with the procedure name as function name.

 

You can also specify the data type of return value by adding as clause after the function name. If return type of Procedure is Currency the procedure should be named as curCommission()

 

The return value can be used as follows:

 

Private Function curCommission(ByVal curSalesAmount as Currency) as Currency

 

‘Calculate the sales commission

If curSalesAmount < 1000 Then

curCommission = 0

Else

curCommission = 1.5 * curSalesAmount

End If

End Function

 





About Dinesh Thakur

Dinesh ThakurDinesh Thakur holds an B.SC (Computer Science), MCSE, MCDBA, CCNA, CCNP, A+, SCJP certifications. Dinesh authors the hugely popular blog. Where he writes how-to guides around Computer fundamental , computer software, Computer programming, and web apps. For any type of query or something that you think is missing, please feel free to Contact us.