16,721
社区成员




'循环窗口中的所有控件
For Each con As Control In Me.Controls
'如果当前控件是Label的时候
If TypeOf con Is Label Then
'改变Label的Text属性
con.Text = con.Text.Substring(5)
End If
Next con
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim arr As New ArrayList
arr.Add(Me.Label1.Text)
arr.Add(Me.Label2.Text)
arr.Add(Me.Label3.Text)
arr.Add(Me.Label4.Text)
arr.Add(Me.Label5.Text)
For i As Integer = 0 To arr.Count - 1
arr(i) = Replace(arr(i), arr(i), i + 1)
Next
Me.Label1.Text = arr.Item(0)
Me.Label2.Text = arr.Item(1)
Me.Label3.Text = arr.Item(2)
Me.Label4.Text = arr.Item(3)
Me.Label5.Text = arr.Item(4)
End Sub