开发者

How do I find the associated the field and table bound to a control in C#?

开发者 https://www.devze.com 2022-12-23 02:21 出处:网络
I\'m generating some code from a form object using reflection.I want to iterate through all the controls on the form and output the field and table that each control is bound to.Right now, I am 开发者

I'm generating some code from a form object using reflection. I want to iterate through all the controls on the form and output the field and table that each control is bound to. Right now, I am 开发者_如何学Cable to output the databound field for a control:

 if ((control is Label) || (control is TextBox)) {
  if (control.DataBindings["Text"] != null) {
   field = GetFieldDisplayName(control.DataBindings["Text"].BindingMemberInfo.BindingField);
  }
 }

Getting the field is useless for me if I can't find its associated table programmatically.

0

精彩评论

暂无评论...
验证码 换一张
取 消