我有下面的代码返回保费金额,但是我不确定如何使它显示在另一个功能中。我想将子例程获取的值仅显示有关所选选项的文本,然后我需要显示根据这些结果计算出的值。
Function ProcessClaims(ClaimsList As claimsList, PremiumIn As Decimal) As Decimal
Dim adjustedPremium, originalPremium As Decimal
Dim declined As Decimal
originalPremium = ClaimsList.claimValue * 100 \ 5
If ClaimsList.claimValue <= 5000 And ClaimsList.isPersonalInjury = False Then
adjustedPremium = originalPremium
ElseIf ClaimsList.claimValue > 5000 And ClaimsList.claimValue <= 10000 And ClaimsList.isPersonalInjury = False Then
adjustedPremium = originalPremium * 100 / 10
ElseIf ClaimsList.claimValue > 10000 Or ClaimsList.isPersonalInjury = False Then
adjustedPremium = -1.0
declined = -1.0
End If
If adjustedPremium = -1.0 Then
PremiumIn = declined
Else
PremiumIn = adjustedPremium
End If
Return PremiumIn
End Function
任何帮助将不胜感激,谢谢
答案 0 :(得分:0)
这很简单..
您显示结果的子/函数应定义为
Private Sub DisplayStuff(premiumInResult as decimal)
'display the value premiumInResult in here
End Sub
您可以执行此操作,这更加清晰
Dim result As Decimal = ProcessClaims(yourClaimsList , yourPremiumIn)
DisplayStuff(result)
或
Displaystuff(ProcessClaims(yourClaimsList , yourPremiumIn))
更短但更不清晰,使调试更加困难