如何将此VB.NET语句转换为C#语句?????
Dim Ctrl As Control Dim txt As System.Windows.Forms.TextBox For Each Ctrl In Controls If TypeOf (Ctrl) Is System.Windows.Forms.TextBox Then txt = CType(Ctrl, System.Windows.Forms.TextBox) txt.Text = "" End If Next
Dim Ctrl As Control Dim txt As System.Windows.Forms.TextBox For Each Ctrl In Controls If TypeOf (Ctrl) Is System.Windows.Forms.TextBox Then txt = CType(Ctrl, System.Windows.Forms.TextBox) txt.Text = "" End If Next
答案:Control Ctrl;
System.Windows.Forms.TextBox txt ;
Foreach(Control ctrl in this.Controls)
if(ctrl is System.Windows.Forms.TextBox)
{
txt=(System.Windows.Forms.TextBox)ctrl;
txt.Text = "" ;
}
上一个:一个vb.net程序
下一个:vb.net如何实现窗体的透明效果