ASP.NET Select Case ใช้ตรวจสอบและทางเลือกเงื่อนไขการเป็นจริง
Syntax
Select Case Expression Case Expression1
Statement1 Case Expression2
Statement2 Case Expression3
Statement3 Case Else
Statement Else
End Select
SelectCase.aspx
<%@ Page Language="VB" %>
<script runat="server">
Sub Page_Load(sender As Object, e As EventArgs)
Select Case Now.Day
Case 10
Me.lblText1.Text = "Now Day = 10-11-2008 (DD-MM-YYY)"
Case 11
Me.lblText1.Text = "Now Day = 11-11-2008 (DD-MM-YYY)"
Case 12
Me.lblText1.Text = "Now Day = 12-11-2008 (DD-MM-YYY)"
Case 13
Me.lblText1.Text = "Now Day = 13-11-2008 (DD-MM-YYY)"
Case 14
Me.lblText1.Text = "Now Day = 14-11-2008 (DD-MM-YYY)"
Case Else
Me.lblText1.Text = "Now Day = " & Format(Now.Date,"dd-M-yyyy")
End Select
End Sub
</script>
<html>
<head>
</head>
<body>
<form runat="server">
<asp:Label id="lblText1" runat="server"></asp:Label><br />
</form>
</body>
</html>