0

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
1
Contributor
1
Reply
2
Views
7 Years
Discussion Span
Last Post by bauc
0

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.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.