●列出陣列的所有值:
●列出表裡上的所有元件名稱:
Public Class Form1
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim ary() As Integer = {5, 4, 3, 2, 1, 0}
TextBox1.Text = ""
For Each x As Integer In ary
TextBox1.Text = TextBox1.Text + CStr(x) & Chr(13) + Chr(10)
Next
End Sub
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
Dim Rtvl As String = ""
TextBox1.Text = ""
For Each x As Control In Me.Controls
Rtvl &= x.Name & ", "
Next
TextBox1.Text = Rtvl
End Sub
End Class
沒有留言:
張貼留言