Multiple conditions in If statement (VB.net) : If Statement « Language Basics « ASP.Net






Multiple conditions in If statement (VB.net)

<%@ Page Language="VB" %>
<script runat="server">
    Sub Calendar1_SelectionChanged(sender As Object, e As EventArgs)
      If Day (Calendar1.SelectedDate) = 13 And Calendar1.SelectedDate.DayOfWeek = 5 Then
        Label1.Text = "Careful! Friday 13th is an unlucky day for some people!"
      Else
        Label1.Text = "It's just another day in life..."
      End If
    End Sub

</script>
<html>
<head>
</head>
<body>
    <form runat="server">
        <p>
            Please select a date:
        </p>
        <p>
            <asp:Calendar id="Calendar1" runat="server" OnSelectionChanged="Calendar1_SelectionChanged"></asp:Calendar>
        </p>
        <p>
            <asp:Label id="Label1" runat="server"></asp:Label>
        </p>
    </form>
</body>
</html>

           
       








Related examples in the same category

1.Nested if statement (VB.net)
2.If statement the check the input value from asp:TextBox (VB.net)
3.If then Demo (C#)
4.If else Demo (C#)
5.Nested if statement (C#)