web 2.0

VB.NET & Select Case

VB.NET & Select Case - Select Case : Runs one of several groups of statements, depending on the value of an expression.

ShotDev Focus:
- VB.NET & Select Case

Syntax


Select [ Case ] testexpression
[ Case expressionlist
[ statements ] ]
[ Case Else
[ elsestatements ] ]
End Select

Example

SelectCase.aspx

<%@ Page Language="VB" %>
<script runat="server">

Sub Page_Load(sender As Object, e As EventArgs)
'*** Current Date 22-Jun-2010 ***'
Select Case Now.Day
Case 21
Me.lblText1.Text = "Now Day = 21-06-2010 (DD-MM-YYY)"
Case 22
Me.lblText1.Text = "Now Day = 22-06-2010 (DD-MM-YYY)"
Case 23
Me.lblText1.Text = "Now Day = 23-06-2010 (DD-MM-YYY)"
Case 24
Me.lblText1.Text = "Now Day = 24-06-2010 (DD-MM-YYY)"
Case 25
Me.lblText1.Text = "Now Day = 25-06-2010 (DD-MM-YYY)"
Case Else
Me.lblText1.Text = "Now Day = " & Format(Now.Date,"dd-MM-yyyy")
End Select
End Sub

</script>
<html>
<head>
<title>ShotDev.Com Tutorial</title>
</head>
<body>
<form runat="server">
<asp:Label id="lblText1"  runat="server"></asp:Label><br />
</form>
</body>
</html>

Screenshot

VB.NET & Select Case
.
.
.
Download this script.
Download

1 Star2 Stars3 Stars4 Stars5 Stars6 Stars7 Stars8 Stars9 Stars10 Stars (No Ratings Yet)
Loading ... Loading ...

Leave a Reply

You must be logged in to post a comment.