TextBox重写Text属性
/// <summary> /// 赋值文本 /// </summary> protected string zText; /// <summary> /// 赋值文本 /// </summary> public override string Text { set { base.Text = value; zText = value; //查找材料清单 if (DtMat!=null) { var Dens = DtMat.AsEnumerable() .Where(p => p.Field<string>("MaterialName").ToUpper() == zText.ToUpper()) .Select(p => p.Field<double>("MaterialDensity")); if (Dens.Count() > 0) { MatDensity = Dens.FirstOrDefault(); } else { MatDensity = 0; } } } get { return base.Text; } }