0

Hi,

I have multiple Controls grouped in Groupboxes. I want to select the control from groupbox dynamically. For example, I am able to select the controls from GroupBox1 with the code below. However, I want to make it dynamically so that users can select any controls from any GroupBox.

Would appreciate your help and suggestion.
Thank you.

 Private Sub addSelectedClickHandlers()
        Try

            For Each selectedControl As Control In GroupBox1.Controls

                AddHandler selectedControl.MouseMove, AddressOf selectedControl_MouseMove

                AddHandler selectedControl.MouseLeave, AddressOf selectedControl_MouseLeave

            Next

        Catch ex As Exception

            Debug.Print(ex.ToString)

        End Try

    End Sub
2
Contributors
1
Reply
15
Views
4 Years
Discussion Span
Last Post by kRod
0

You might try something like this.....

 Private Sub addSelectedClickHandlers(ByVal gb As GroupBox)


Try

            For Each selectedControl As Control In gb.Controls

                AddHandler selectedControl.MouseMove, AddressOf selectedControl_MouseMove

                AddHandler selectedControl.MouseLeave, AddressOf selectedControl_MouseLeave

            Next

        Catch ex As Exception

            Debug.Print(ex.ToString)

        End Try

    End Sub
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.