1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22
| Class Form1
Private DicoTxt As Dictionary(Of Integer, txt) = New Dictionary(Of Integer, txt)
Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load
For Each C As Object In Me.Controls
If C.GetType.ToString = "System.Windows.Forms.TextBox" Then
DicoTxt.Add(DicoTxt.Count + 1, New txt(C))
End If
Next
For i As Integer = 1 To DicoTxt.Count
DicoTxt(i).TX.Text = "Bla bla"
Next
End Sub
End Class
Public Class txt
Public WithEvents TX As TextBox
Private Sub tx_TextChanged(sender As Object, e As EventArgs) Handles TX.TextChanged
MessageBox.Show("toto")
End Sub
Public Sub New(ByRef T As TextBox)
TX = T
End Sub
End Class |
Partager