Quantcast
Channel: What is wrong with this code??? I need to display a message if there is less or more than 5 checkboxes selected...thx
Viewing all articles
Browse latest Browse all 8

What is wrong with this code??? I need to display a message if there is less or more than 5 checkboxes selected...thx

$
0
0

<%@ Page Language="VB" AutoEventWireup="false" CodeFile="Excercise1.aspx.vb" Inherits="Excercise1" %>

<!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></title>
</head>
<body>
    <form id="form1" runat="server">
    <div>

        Which books have you read?<br />
        <asp:CheckBox ID="CheckBox1" runat="server" text="Sams Teach Yourself Active Server Pages 3.0 in 21 days"/><br />
        <asp:CheckBox ID="CheckBox2" runat="server" text="Designing Active Server Pages"/><br />
        <asp:CheckBox ID="CheckBox3" runat="server" text="ASP.NET: Tips, Tutorials, and Code"/><br />
        <asp:CheckBox ID="CheckBox4" runat="server" text="ASP.NET Data Web Controls"/><br />
        <asp:CheckBox ID="CheckBox5" runat="server" text="Sams Teach Yourself ASP.NET in 24 Hours"/><br />
        <asp:CheckBox ID="CheckBox6" runat="server" text="Sams Teach Yourself ASP.NET 2.0 in 24 Hours"/><br />
        <asp:CheckBox ID="CheckBox7" runat="server" text="Sams Teach Yourself ASP.NET 3.5 in 24 Hours"/><br /><br />
        <asp:Button ID="SubmitButton" runat="server" Text="Click Me" /><br /><br />
        <asp:Label ID="Results" runat="server"></asp:Label>

    </div>
    </form>
</body>
</html>

code:


Partial Class Excercise1
    Inherits System.Web.UI.Page

    Protected Sub SubmitButton_Click(sender As Object, e As System.EventArgs) HandlesSubmitButton.Click
        Dim CheckBox As Object()

        If CheckBox.Checked <= 5 Then
            Results.Text = "You are indeed a wonderful person"
        ElseIf CheckBox.checked > 5 Then
            Results.Text = "It is absolutely imperative that you go to your nearest bookstore without delay and pick up on (or more of Scott's books!)"
        End If



    End Sub
End Class



Viewing all articles
Browse latest Browse all 8

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>