TheWizardofInt Posted August 22, 2002 Posted August 22, 2002 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? <%@ 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! Quote Read the Fovean Chronicles Because you just can't spend your whole day programming!
*Gurus* Thinker Posted August 22, 2002 *Gurus* Posted August 22, 2002 Look at the Page_Load parameters. See the e as EventArgs. Don't use e for the exception object too. Just pick something else. Quote Posting Guidelines
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.