如何通过控件的名字来获取这个控件? 在一个应用程序里,已经知道一个Button的Name为button1那应该如何获取这个控件?使得可以做改变这个控件的text等操作 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 class Form1 : Form{ ...... public void FindControl() { FindControlByName(this); } private void FindControlByName(Control ctrl) { foreach (Control c in ctrl.Controls) { if (c.Name == "button1") MessageBox.Show("Findit"); if (c.Controls.Count != 0) FindControlByName(c); } }} foreach (Control c in this.Controls) { if (c.Name == "yourCName") return c; } for(int i = this.panel1.Controls.Count - 1 ; i >= 0 ; i --) { //如果是名字以lbName开头 if(panel1.Controls[i].Name.ToString().Equals("button1")) { Button *** = new Button();*** = panel1.Controls[i];break; } } winform水晶报表打印多张订单 很急很急 帮帮我 datagridview 插入数据 如何实现文件的读取 请问VS.C#的代码编辑器中能否插入说明图片 问一个关于ArrayList 的问题(急) 能否在不启动vs2008的情况下编译整个solution? 水晶报表怎么实现以下的功能(高手请进,解决了我请客) C#怎么利用Chart控件绘制极坐标图 算法问题,请高手指点,很急,在线等候,马上给分! 文件下载打开问题 如何利用C#锁键盘
{
......
public void FindControl()
{ FindControlByName(this); } private void FindControlByName(Control ctrl)
{
foreach (Control c in ctrl.Controls)
{
if (c.Name == "button1")
MessageBox.Show("Findit");
if (c.Controls.Count != 0)
FindControlByName(c);
}
}
}
{
if (c.Name == "yourCName")
return c;
}
{
//如果是名字以lbName开头
if(panel1.Controls[i].Name.ToString().Equals("button1"))
{
Button *** = new Button();
*** = panel1.Controls[i];
break;
}
}