On a VB.NET project with Metroframework Modern UI 1.4.0.0 installed, I use this part of code into a Module to loop over all MetroTextBox
es which placed into a MetroTabControl
and give Cursor.Hand
to their embedded Clear button. How can I do the same thing including MetroTextBox
es which could be out of MetroTabControl
, into my form or into an other container for example? In other words, I would like to loop over every MetroTextBox
into a form, even if it is nested.
Public Sub TxtBoxes_Cursors(sender, e)
Dim _FormSender = DirectCast(sender, MetroFramework.Forms.MetroForm)
For Each _MetroTabControl As Control In _FormSender.Controls.OfType(Of MetroFramework.Controls.MetroTabControl)()
For Each _TabPage As Control In _MetroTabControl.Controls.OfType(Of MetroFramework.Controls.MetroTabPage)()
For Each _Textbox As Control In _TabPage.Controls.OfType(Of MetroFramework.Controls.MetroTextBox)()
If _Textbox.HasChildren Then
For Each _ClearButton As Control In _Textbox.Controls
If _ClearButton.Name = "lnkClear" Then
_ClearButton.Cursor = System.Windows.Forms.Cursors.Hand
End If
Next
End If
Next
Next
Next
End Sub