C#遍历控件并赋值:
foreach (Control ct in form1.Controls)
{
if (ct is TextBox ) {
(ct as TextBox).Text = "";
}
if (ct is DropDownList) {
(ct as DropDownList).SelectedValue = "";
}
}
VB遍历控件并赋值:
For Each ct As Control In Me.Controls
If TypeOf ct Is TextBox Then
CType(ct, CheckBox).Text = ""
End If
Next