【发布时间】:2013-02-15 22:32:15
【问题描述】:
我有问题。
用户控制
Button : UserControl
...
public string naz
{ get { return this.button1.Text; } }
...
在我的表单上我可以做到这一点
if(button0.naz == "1"){ MessageBox.Show("My Text"); }
if(button1.naz == "1"){ MessageBox.Show("My Text"); }
if(button2.naz == "1"){ MessageBox.Show("My Text"); }
但是当我尝试以下.naz 时无法识别。
for(int i=0;i<=60;i++)
{
if(this.Controls["button" + i.ToString()).naz == "1")
{
MessageBox.Show("My Text");
}
}
【问题讨论】: