Hi all
When i run this app, select the checkbox and press the calculate button i get the following error message 'Object reference not set to an instance of an object.'
If i dont select the checkbox and press the calculate button the 2nd page loads with the text 'Bathroom with WC'
Does anyone know what i have done wrong?
<%@ Page Language="VB" Debug="true" Inherits="nihe.SimpleRent" ContentType="text/html" ResponseEncoding="iso-8859-1" %>
<html>
<body>
<form runat="server">
Bathroom with W/C:
<asp:CheckBox id="bath_wc" runat="server"></asp:CheckBox>
<p>
<asp:button id="calcbutton" onclick="calculate" runat="server" text="calculate"></asp:button>
</p>
</form>
</body>
</html>
' SimpleRent.vb
'
Imports System
Imports System.Web
Imports System.Web.UI
Imports System.Web.UI.WebControls
Namespace nihe
Public Class SimpleRent : inherits page
protected withevents bath_wc As system.web.ui.webcontrols.checkbox
protected withevents row_bwc As system.web.ui.webcontrols.TableRow
Public sub calculate(source as Object, e as EventArgs)
if bath_wc.checked then
bath_wc.text = "+3"
Context.Items.Add("bath_wc", bath_wc.text)
row_bwc.Visible = bath_wc.checked
end if
server.transfer("SimpleResult.aspx")
End Sub
End Class
End Namespace
<%@ Page Language="vb" %>
<script runat="server">
Sub Page_Load(Source as Object, E as EventArgs)
cell_bwc.text = "Bathroom With WC"
value_bwc.text = Context.Items("bath_wc")
End Sub
</script>
<html>
<body>
<form>
<asp:Table runat="server">
<asp:TableRow id="row_bwc">
<asp:TableCell id="cell_bwc"></asp:TableCell>
<asp:TableCell id ="value_bwc"></asp:TableCell>
</asp:TableRow>
</asp:Table>
</form>
</body>
</html>
Many thanks in advance
When i run this app, select the checkbox and press the calculate button i get the following error message 'Object reference not set to an instance of an object.'
If i dont select the checkbox and press the calculate button the 2nd page loads with the text 'Bathroom with WC'
Does anyone know what i have done wrong?
<%@ Page Language="VB" Debug="true" Inherits="nihe.SimpleRent" ContentType="text/html" ResponseEncoding="iso-8859-1" %>
<html>
<body>
<form runat="server">
Bathroom with W/C:
<asp:CheckBox id="bath_wc" runat="server"></asp:CheckBox>
<p>
<asp:button id="calcbutton" onclick="calculate" runat="server" text="calculate"></asp:button>
</p>
</form>
</body>
</html>
' SimpleRent.vb
'
Imports System
Imports System.Web
Imports System.Web.UI
Imports System.Web.UI.WebControls
Namespace nihe
Public Class SimpleRent : inherits page
protected withevents bath_wc As system.web.ui.webcontrols.checkbox
protected withevents row_bwc As system.web.ui.webcontrols.TableRow
Public sub calculate(source as Object, e as EventArgs)
if bath_wc.checked then
bath_wc.text = "+3"
Context.Items.Add("bath_wc", bath_wc.text)
row_bwc.Visible = bath_wc.checked
end if
server.transfer("SimpleResult.aspx")
End Sub
End Class
End Namespace
<%@ Page Language="vb" %>
<script runat="server">
Sub Page_Load(Source as Object, E as EventArgs)
cell_bwc.text = "Bathroom With WC"
value_bwc.text = Context.Items("bath_wc")
End Sub
</script>
<html>
<body>
<form>
<asp:Table runat="server">
<asp:TableRow id="row_bwc">
<asp:TableCell id="cell_bwc"></asp:TableCell>
<asp:TableCell id ="value_bwc"></asp:TableCell>
</asp:TableRow>
</asp:Table>
</form>
</body>
</html>
Many thanks in advance