当前位置:编程学习 > C#/ASP.NET >>

如何将此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
答案: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如何实现窗体的透明效果

CopyRight © 2012 站长网 编程知识问答 www.zzzyk.com All Rights Reserved
部份技术文章来自网络,