Description: This code demonstrates a web application where users can select a programming language from a list, and a description of the selected language is displayed dynamically.
This file contains the front-end structure of the web application. It includes a ListBox for language selection and a Label to display the description of the selected language.
<%@ Page Language="VB" AutoEventWireup="false" CodeFile="LanguageSelection.aspx.vb" Inherits="LanguageSelection" %> <!DOCTYPE html> <html xmlns="http://www.w3.org/1999/xhtml"> <head runat="server"> <title>Language Selection</title> </head> <body> <form id="form1" runat="server"> <div> <asp:ListBox ID="LanguageListBox" runat="server" AutoPostBack="True" OnSelectedIndexChanged="LanguageListBox_SelectedIndexChanged"> <asp:ListItem>Java</asp:ListItem> <asp:ListItem>Javascript</asp:ListItem> <asp:ListItem>C++</asp:ListItem> <asp:ListItem>C</asp:ListItem> <asp:ListItem>Python</asp:ListItem> <asp:ListItem>SQL</asp:ListItem> <asp:ListItem>HTML</asp:ListItem> <asp:ListItem>CSS</asp:ListItem> <asp:ListItem>PHP</asp:ListItem> </asp:ListBox> <br /> <asp:Label ID="LanguageLabel" runat="server" Text=""></asp:Label> </div> </form> </body> </html>
This file contains the back-end logic for the application. It handles the SelectedIndexChanged
event of the ListBox and updates the Label with a description of the selected programming language.
Partial Class LanguageSelection Inherits System.Web.UI.Page Protected Sub LanguageListBox_SelectedIndexChanged(sender As Object, e As EventArgs) Dim selectedLanguage As String = LanguageListBox.SelectedValue Dim message As String = "" Select Case selectedLanguage Case "Java" message = "Java is a versatile and platform-independent programming language." Case "Javascript" message = "JavaScript is a scripting language primarily used for web development." Case "C++" message = "C++ is an extension of C and supports object-oriented programming." Case "C" message = "C is a powerful general-purpose programming language." Case "Python" message = "Python is a high-level, interpreted programming language known for its simplicity." Case "SQL" message = "SQL is used to manage and query relational databases." Case "HTML" message = "HTML is the standard markup language for creating web pages." Case "CSS" message = "CSS is used to style and layout web pages." Case "PHP" message = "PHP is a server-side scripting language designed for web development." End Select LanguageLabel.Text = message End Sub End Class
LanguageListBox_SelectedIndexChanged
event is triggered.When a user selects a language (e.g., Python), the following message is displayed:
Python is a high-level, interpreted programming language known for its simplicity.