怎么能获得这个控件属性
睡神在睡觉 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]