Search Your Dot Net Topic

Saturday, 1 May 2021

ternary operator in vb net | ternary operator example vb.net | how to w...





<%@ Page Language="VB" AutoEventWireup="false" CodeFile="ternary-operator-vbnet.aspx.vb" Inherits="ternary_operator_vbnet" %>

<!DOCTYPE html>

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title></title>
</head>
<body>
    <form id="form1" runat="server">
    <div>
    <asp:Label ID="lblResult" runat="server"></asp:Label>
    </div>
    </form>
</body>
</html>




Partial Class ternary_operator_vbnet
    Inherits System.Web.UI.Page

    Protected Sub Page_Load(sender As Object, e As EventArgs) Handles Me.Load
        Dim Marks = 45
        Dim ExamResult As String = If(Marks > 40, ”Pass”, “Fail”)
        lblResult.Text = ExamResult
    End Sub
End Class

No comments:

Post a Comment