object obj = this.GetType().GetField("控件名",
System.Reflection.BindingFlags.NonPublic | System.Reflection.BindingFlags.Instance
| System.Reflection.BindingFlags.IgnoreCase).GetValue(this);
ComboBox cb = (ComboBox)obj;
TextBox text = sender as TextBox;
int id = 0;
String str = null;
switch (text.Name)
public delegate void ShowMessage();//创建一个代理
public void ShowTextBox(TextBox tx,String num)
{
if (tx.InvokeRequired)
{
ShowMessage msg;
msg = () =>
{
tx.Text = num;
};
tx.Invoke(msg);
return;
}
else
{
tx.Text = num;
}
}
原文:https://www.cnblogs.com/memorypro/p/10576319.html