Here is an implementation of what OriginalGriff stated...
This code has been prepared in
LinqPad[
^].
Sub Main
Dim mf As MyForm = New MyForm()
mf.Show()
End Sub
Public Class MyForm
Inherits Form
Private lblStatus As Label
Public Sub New()
Dim BaseTB As New TextBox
Dim XS As String() = {"PENDING.", "APPROVED.", "WAITING.", "AUTHORIZED.", "REGISTERED.", "TIME-OUT."}
Dim XTC As String() = {"A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K", "L", "M", "N", "O", "P", "Q", "R", "S", "T", "U", "V", "W", "X", "Y", "Z"}
Dim NoOfRows As Integer = XS.Length -1
Dim NoOfCols As Integer = XTC.Length -1
For rn As Integer = 0 To NoOfRows
Dim tb As TextBox = New TextBox() With {.Name = $"TextBox{rn}", .Location = New Point(4, (28 * rn) +4), .Size= New Size(90, 24), .Text =XS(rn), .Enabled=False}
Me.Controls.Add(tb)
For cn As Integer = 0 To NoOfCols
Dim lbPoint = New Point(tb.Location.X + tb.Width + (20 *cn) +4 , tb.Location.Y)
Dim lb As Label = New Label() With {.Name = $"Label{rn}", .Location = lbPoint, .AutoSize = False, .Size = New Size(20,20), _
.BorderStyle = BorderStyle.Fixed3D, .TextAlign = HorizontalAlignment.Center, .Text =XTC(cn), .Tag = tb}
AddHandler lb.Click, AddressOf MyLabel_Click
Me.Controls.Add(lb)
Next cn
Next rn
lblStatus = New Label() With {.AutoSize = True, .Location = New Point(4, NoOfRows * 35), .ForeColor = Color.Brown, .Text = "Click on [A-Z] to get status related to it."}
Me.Controls.Add(lblStatus)
Me.ShowIcon = False
Me.MinimizeBox = False
Me.MaximizeBox = False
Me.Size = New Size(660,240)
End Sub
Private Sub MyLabel_Click(sender As Object, e As EventArgs)
Dim lb As Label = DirectCast(sender, Label)
Dim tb As TextBox = DirectCast(lb.Tag, TextBox)
lb.Font = New Font("Arial", 9, FontStyle.Bold)
lb.ForeColor = Color.Red
lb.BackColor = Color.Yellow
lblStatus.Text = ($"You've clicked '{lb.Text}' related with {tb.Text}.")
End Sub
End Class
Above code needs the following references:
* <RuntimeDirectory>\Microsoft.VisualBasic.dll
* <RuntimeDirectory>\System.Windows.Forms.dll
and namespaces:
* Microsoft.VisualBasic
* System.Drawing
* System.Windows.Forms