web 2.0

VB.NET & IF…Else…End IF

VB.NET & IF…Else…End IF - IF…Else…End IF : Conditionally executes a group of statements, depending on the value of an expression.

ShotDev Focus:
- VB.NET & IF…Else…End IF

Syntax


If condition [ Then ]
[ statements ]
[ Else
[ elsestatements ] ]
End If
-or-
If condition Then [ statements ] [ Else [ elsestatements ] ]

Example

IIElseEndIF.aspx

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

Sub Page_Load(sender As Object, e As EventArgs)
'*** Current Date 22-Jun-2010 ***'
IF Now.Day = 22 Then
Me.lblText1.Text = "Now Day = 22-06-2010 (DD-MM-YYY)"
Else
Me.lblText1.Text = "Now Day = " & Format(Now.Date,"dd-MM-yyyy")
End IF
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>
</html>

Screenshot

VB.NET & IF…Else…End IF
.
.
.
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.