I need your help. Please help me.
I have been asked to transfer the FUNCTION FCalculate from WebFrmLoan.aspx to Web Page CODEBEHIND. The Functon event is to calculate the Loan Monthly Repayment amount.
I have not done it before using VBScript and it generated this error message.
Option Strict On requires all Function, Property, and Operator declarations to have an 'As' clause.
This is the coding that generate the error message:
Expand|Select|Wrap|Line Numbers
- <script language= "vbscript" runat=server>
- Protected Function FCalculate(ByVal Sender As Object, ByVal e As EventArgs)
- Dim intPaym As Double = 0
- intPaym = (CType(Me.txtLoanAmt.Text, Double) / CType(Me.txtTotalMonth.Text, Long))
- End Function
- </script>
Here are the overall coding from WEB PAGE CODEBEHIND:
Expand|Select|Wrap|Line Numbers
- <%@ Page Language="vb" AutoEventWireup="false" CodeBehind="WebFrmClientSideScript.aspx.vb" Inherits="ASPNET2008DataEntry.WebFrmClientSideScript" %>
- <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
- <html xmlns="http://www.w3.org/1999/xhtml" >
- <head runat="server">
- <title>Loan Repayment Page</title>
- <link href="StyleSheet1.css" rel="stylesheet" type="text/css" />
- <style type="text/css">
- .style1
- {
- width: 547px;
- }
- </style>
- </head>
- <!-- -------------------------------------------------------------------- -->
- <script language= "vbscript" runat= server>
- Protected Function FCalculate(ByVal Sender As Object, ByVal e As EventArgs)
- Dim intPaym As Double = 0
- intPaym = (CType(Me.txtLoanAmt.Text, Double) / CType(Me.txtTotalMonth.Text, Long))
- End Function
- </script>
- <!-- -------------------------------------------------------------------- -->
- <body>
- <form id="form1" runat="server">
- <div class="LeftMargin">
- <asp:Label ID="lbl1" CssClass="labelBanner" runat="server"
- Text="Loan Monthly Repayment Calculation" >
- </asp:Label>
- </div>
- <br />
- <div class="LeftMargin">
- <table style="width:100%;"
- <tr>
- <td align="left" class="style1">
- <asp:Label ID="lbl2" CssClass="labelText" runat="server" Width="300px"
- Text="Loan Amount $:" ></asp:Label>
- <asp:TextBox ID="txtLoanAmt" CssClass="textbox" runat="server"
- EnableViewState="true" AutoPostBack="false" TabIndex="1"></asp:TextBox>
- </td>
- </tr>
-
- <tr>
- <td class="style1">
- <asp:Label ID="lbl3" CssClass="labelText" runat="server" Width="300px"
- Text="Repayment Months Count :"></asp:Label>
- <asp:TextBox ID="txtTotalMonth" CssClass="textbox" runat="server"
- EnableViewState="true" AutoPostBack="false" TabIndex="2"></asp:TextBox>
- </td>
-
- <td>
- <asp:Label ID="lbl4" CssClass="labelText" runat="server" Width="400px"
- Text="Monthly Repayment Amount :"></asp:Label>
- <asp:TextBox ID="txtPayAmt" CssClass="textbox" runat="server"
- EnableViewState="true" AutoPostBack="false" TabIndex="3"
- Enabled="false" ></asp:TextBox>
- </td>
- </tr>
- <tr class="LeftMargin">
- <td>
- <asp:Label ID="lbl5" runat="server" Width="200px"></asp:Label>
- <asp:Button ID="BtnCalculate" CssClass="Button" runat="server"
- Text="Monthly Payment Calculate" OnClick="FCalculate"
- Width="200px" />
- </td>
- </tr>
- </table>
- </div>
- </form>
- </body>
- </html>