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






' Part a Default.aspx.vb Partial Class _Default Inherits System.Web.UI.Page Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load Dim languages() As String = {"C++", "Java", "Kotlin", "C", "Assembly", "VB.NET", "Fortran"} Dim size As Decimal = languages.Length() If Me.IsPostBack = False Then For i = 0 To size - 1 cb1.Items.Add(languages(i)) Next End If End Sub Private Sub showLanguages() Handles btn1.ServerClick label1.Text = "You Choose :
" Dim listItem As ListItem For Each listItem In cb1.Items If (listItem.Selected) Then label1.Text &= "
" + listItem.Text End If Next End Sub End Class <%@ Page Language="VB" AutoEventWireup="false" CodeFile="Default.aspx.vb" Inherits="_Default" %>


   





' Part b Default.aspx.vb Partial Class _Default Inherits System.Web.UI.Page Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load If Me.IsPostBack = False Then End If End Sub Protected Sub createTable() Handles btnCreate.Click Dim row, col As Integer row = CType(textBoxRows.Text, Integer) col = CType(textBoxColumns.Text, Integer) For i = 0 To row - 1 Dim tableRow As New TableRow For j = 0 To col - 1 Dim tableCell As New TableCell Dim textLabel As New Label With { .Text = "Example Cell (" & (i + 1).ToString() & "," & (j + 1).ToString() & ")" } If checkBoxBorder.Checked Then tableCell.Style.Add("border", "5px solid gray") End If tableCell.Controls.Add(textLabel) tableRow.Controls.Add(tableCell) Next Table.Controls.Add(tableRow) Next End Sub End Class <%@ Page Language="VB" AutoEventWireup="false" CodeFile="Default.aspx.vb" Inherits="_Default" %> Event Tracker

Controls being monitored for change events:





List of events:





' Part c Default.aspx.vb Partial Class _Default Inherits System.Web.UI.Page Protected Sub Page_Load(ByVal sender As Object, ByVal e As EventArgs) Handles Me.Load Log("<< Page_Load >>") End Sub Protected Sub Page_PreRender(ByVal sender As Object, ByVal e As EventArgs) Handles Me.PreRender ' When the Page.PreRender event occurs it is too late ' to change the list. Log("Page_PreRender") End Sub ' This control handles an event from all four controls. Protected Sub CtrlChanged(ByVal sender As Object, ByVal e As System.EventArgs) _ Handles chk.CheckedChanged, opt1.CheckedChanged, opt2.CheckedChanged, txt.TextChanged ' Find the control ID of the sender. ' This requires converting the Object type into a Control class. Dim ctrlName As String = CType(sender, Control).ID Log(ctrlName & " Changed") End Sub Private Sub Log(ByVal entry As String) lstEvents.Items.Add(entry) ' Select the last item to scroll the list so the most recent ' entries are visible. lstEvents.SelectedIndex = lstEvents.Items.Count - 1 End Sub End Class