怎么能获得这个控件属性

睡神在睡觉 2008-07-15 02:38:58
Form1中:
code=C#] public Control GetControl(string name)
{
foreach (Control c in this.Controls)
{
MessageBox.Show(c.Text);
if (c.Name == name) return c;
}
return null;
}
private void Next_Click(object sender, EventArgs e)
{
Form work = new Form();
Button OK1 = new Button();
TabControl Tabcon = new TabControl();
OK1.Click += new EventHandler(OK1_Click);

}
void OK1_Click(object sender, EventArgs e)
{

if (GetControl("Tabcon").Text == "")
{
MessageBox.Show("请填写正确的泊位!", "错误", MessageBoxButtons.OKCancel, MessageBoxIcon.Hand, MessageBoxDefaultButton.Button1);
return;
}
[[/code]
...全文
32 回复 打赏 收藏 转发到动态 举报
写回复
用AI写文章
回复
切换为时间正序
请发表友善的回复…
发表回复

110,529

社区成员

发帖
与我相关
我的任务
社区描述
.NET技术 C#
社区管理员
  • C#
  • Web++
  • by_封爱
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告

让您成为最强悍的C#开发者

试试用AI创作助手写篇文章吧