TheWizardofInt
Junior Contributor
Ok, after purchasing Visual Studio .net, doing millions of downloads and following directions here, I think I have ASP.net installed on my PC.
However, when I run the following code, I get a blank screen, no errors.
This page is opened by another page with the Value1, Value2 and Operator values embedded, and the header of the .apsx page is:
http://mediagate-219/Learning/math.aspx?value1=8&operator=add&value2=2
Am I missing the point of Resonse.Write?
However, when I run the following code, I get a blank screen, no errors.
This page is opened by another page with the Value1, Value2 and Operator values embedded, and the header of the .apsx page is:
http://mediagate-219/Learning/math.aspx?value1=8&operator=add&value2=2
Code:
<%@Import Namespace="System.Decimal" %>
<script language="VB" 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>
Am I missing the point of Resonse.Write?