How do you know what event called the current event?

Background: I'm trying to return a value to a textbox on form1 from form2. Form2 displays a dynamic list of labels based on a database and I've added event handlers to each label's click event which then calls the below Sub, I know how to get the object that was clicked on but I want to then return to form1's calling textbox and fill it's .text value based on form2's label. I've searched but don't seem to know the write word or can't find someone else trying this (bad sign on my search or method)

Any help will be appreciated.

Public Sub LClick(ByVal sender As System.Object, ByVal e As System.EventArgs)

        If sender.GetType.ToString = "System.Windows.Forms.Label" Then

            Dim myObject As Label = sender

            MsgBox(myObject.Name)

        End If

    End Sub

I've seemingly got a work around for this by creating a form class level variable to store the original calling textbox but would like to know if there is a better way to do this.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.