Hola amigos como estan, saben tengo este codigo que funciona, para poner color en el fondo del textbox, pero esto no funciona si los textbox estan dentro de un groupbox.
Como se lo pondria para que los textbox que estan dentro del groupbox tambien tenga efecto el cambio de color.
Código:
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Dim ctrl As Control
For Each ctrl In Me.Controls
If (TypeOf (ctrl) Is TextBox) Then
Dim miTextBox As TextBox
miTextBox = CType(ctrl, TextBox)
AddHandler miTextBox.Enter, AddressOf TieneFoco
AddHandler miTextBox.Leave, AddressOf PierdeFoco
End If
Next
End Sub
Private Sub PierdeFoco(ByVal sender As Object, ByVal e As System.EventArgs)
Dim miTextBox As TextBox
miTextBox = CType(sender, TextBox)
miTextBox.BackColor = Color.White
End Sub
Private Sub TieneFoco(ByVal sender As Object, ByVal e As System.EventArgs)
Dim miTextBox As TextBox
miTextBox = CType(sender, TextBox)
miTextBox.BackColor = Color.Yellow
End Sub
suerte