C# 根据控件名动态找控件、获取当前操作控件名

(TextBox) (this.Controls.Find("textbox1", true)[0])
this.Controls["textBox1"].Text

 private void txtbox_DoubleClick(object sender, EventArgs e)
        {
            TextBox selTextBox = (TextBox)sender;
            if (selTextBox.Name == "textbox1")
            {
                EquipmentDlg equip = new EquipmentDlg();
                equip.ShowDialog();
            }
        }
posted @ 2020-12-16 11:05  YiXiaoKezz  阅读(2380)  评论(0编辑  收藏  举报