ASP.NET Hello World with VB.NET

ASP.Net is one of the technologies, which I have not mentioned in my site. Thus, I will start mentioning it, because it is probably amongst the very few, which use still use VB. And due to some weird reason, I am a VBA fan. So, I have started to follow the SoftUni courses for ASP.NET and I have decided to make a simple “Hello World” application. As simple as it can be 🙂 Something like a button and two labels – one to say “Hello World” and another one to show the current time:

HelloWorld

That is all. The labels are not visible when “the site” is loaded, but they become visible later, when the button is clicked. 🙂

Here comes the code:

Partial Class _Default
    Inherits System.Web.UI.Page

    Protected Sub btnShowHello_Click(sender As Object, e As EventArgs) Handles btnShowHello.Click

        Me.lblHelloWorld.Text = "Hello World"
        Me.lblHelloWorld.Visible = True

        Me.lblTime.Text = Date.Now
        Me.lblTime.Visible = True
    End Sub

End Class
<%@ Page Language="VB" AutoEventWireup="false" CodeFile="Default.aspx.vb" Inherits="_Default" %>

<!DOCTYPE html>

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title></title>
</head>
<body>
    <form id="form1" runat="server">
    <div>
    
        <asp:Button ID="btnShowHello" runat="server" Text="Button" />
        <asp:Label ID="lblHelloWorld" runat="server" Text="" Visible="false"></asp:Label>
        <asp:Label ID="lblTime" runat="server" Text="" Visible="false"></asp:Label>

    </div>
    </form>
</body>
</html>

Enjoy it! 😀