views:

26

answers:

0

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 able 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.