1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35
|
Public Class Form3
Dim Incre As Integer
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim Test As New System.Windows.Forms.TextBox
Incre += 1
Test.Name = "Blabla" & Incre
Me.Controls.Add(Test)
Test.Text = Test.Name
Test.Location = New Point(10, Incre * 30)
End Sub
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
Dim ctl As Control = Me
While ctl IsNot Nothing
If TypeOf (ctl) Is TextBox Then
Select Case ctl.Name
Case "Blabla1"
ctl.Text = "hello1"
Case "Blabla2"
ctl.Text = "hello2"
Case "Blabla3"
ctl.Text = "hello3"
End Select
End If
ctl = Me.GetNextControl(ctl, True)
End While
End Sub
End Class |