>Hi All, I've been binding WinForms controls to DataTables using the syntax shown below for years and wonder if there's a better way of doing it using a BindingSource - this is what I currently do
>
>
> this.txtLastAmendedUser.DataBindings.Add("Text", dt, "amend_user");
>
>
>where dt is a DataTable and "amend_user" is a field. I typically have a dozen or so controls on a form so it's quite a code intensive method. Is there a better / easier way of binding ?
I had a huge table like this, so I designed a naming convention for the text boxes that related to the columns in the dt and wrote a loop that did the bindings.
It only worked for textboxes. I had to do other controls on my own.
I've used that quite often since then for large tables, but for small tables I use the method you showed.
Anyone who does not go overboard- deserves to.
Malcolm Forbes, Sr.