public Dictionary<string, TextBox> name_tbs = new Dictionary<string, TextBox>();
TextBox TextBoxbyName(string tb_name)
{
return name_tbs(tb_name);
}
现在它显示了当前上下文中存在的错误name_tbs dosent。
答案 0 :(得分:1)
您需要将其放在[]中,因为您正在使用字典的键进行访问,
Dictionary<string, TextBox> name_tbs = new Dictionary<string, TextBox>();
TextBox TextBoxbyName(string tb_name)
{
return name_tbs[tb_name];
}