close
將集合(陣列或物件集合)的每一元素取出
string[ ] student = new string[5]{"1","2","3","4","5"};
foreach (string buf in student)
{
MessageBox.Show(buf);
}
foreach (System.Windows.Forms.Control obj in this.Controls)
{
if (obj.GetType().ToString() == "System.Windows.Forms.TextBox")
{
obj.Text = "這是文字方塊";
}
}
全站熱搜