TheWizardofInt
Junior Contributor
This code give me the error: "BC30616: Variable 'e' hides a variable in an enclosing block" for each of the "Catch e" statements.
Am I declaring e incorrectly?
Thanks!
Am I declaring e incorrectly?
Code:
<%@ Page Language="vb" %>
<%@ import Namespace="System.Decimal" %>
<script runat="server">
Sub Page_Load(Source as Object, e as EventArgs)
Dim decValue1 as Decimal
Dim decValue2 as Decimal
Dim strOperator as String
Dim decResult as Decimal
decValue1 = Request.QueryString("value1")
decValue2 = Request.QueryString("value2")
strOperator = Request.QueryString("operator")
Try
Select Case strOperator
Case "multiply"
decResult = MultiplyValues(decValue1, decValue2)
Case "divide"
decResult = DivideValues(decValue1, decValue2)
Case "add"
decResult = AddValues(decValue1, decValue2)
Case "Subtract"
decResult = SubtractValues(decValue1, decValue2)
End Select
Catch e as OverflowException
response.write("The result was too large to represent as a decimal.")
Catch e as dividebyzeroexception
response.write("You can't divide by zero!")
Finally
Response.Write("The result of your calculation is: " & decResult)
end try
end sub
Function MultiplyValues(decValue1 as decimal, DecValue2 as Decimal)
Dim decResult as Decimal
decResult = Multiply(decValue1, decValue2)
Return decResult
End function
Function DivideValues(decValue1 as decimal, DecValue2 as Decimal)
Dim decResult as Decimal
decResult = Divide(decValue1, decValue2)
Return decResult
End function
Function AddValues(decValue1 as decimal, DecValue2 as Decimal)
Dim decResult as Decimal
decResult = Add(decValue1, decValue2)
Return decResult
End function
Function SubtractValues(decValue1 as decimal, DecValue2 as Decimal)
Dim decResult as Decimal
decResult = Subtract(decValue1, decValue2)
Return decResult
End function
</script>
<html>
<head>
</head>
<body>
</body>
</html>
Thanks!