Winforms User Controls - How do I bind those to a dataset on the host form

  • Thread starter Thread starter John Sheppard
  • Start date Start date
J

John Sheppard

Hello there,

I have a dataset on a form...I shall call the host form.
I also have a user control with a whole bunch of textboxes and
gridviewcontrols on it. I shall call this the leech form.

I want the controls on the leech form to get bound to a dataset and/or
binding sources that reside on the host form.

At the moment I just pass in the dataset by reference to the user control
but this seems like a bit of a cludge...Does anyone have any thoughts on the
best way to go about doing this?

Thank you kindly for your time
John Sheppard
 
John Sheppard said:
Hello there,

I have a dataset on a form...I shall call the host form.
I also have a user control with a whole bunch of textboxes and
gridviewcontrols on it. I shall call this the leech form.

I want the controls on the leech form to get bound to a dataset and/or
binding sources that reside on the host form.

At the moment I just pass in the dataset by reference to the user control
but this seems like a bit of a cludge...Does anyone have any thoughts on
the best way to go about doing this?

Thank you kindly for your time
John Sheppard

You would have to go into your user control and create a mechanism whereby
all data binding properties of the constituent controls are exposed in the
user control. Frankly, IMHO, passing a reference to the dataset sounds much
easier.
 
PvdG42 said:
You would have to go into your user control and create a mechanism whereby
all data binding properties of the constituent controls are exposed in the
user control. Frankly, IMHO, passing a reference to the dataset sounds
much easier.

Thank you PvdG42...yes it is easy, I guess I always feel as though there has
to be a better way...I guess I was after reassurance that this is how other
people do it...

One particular problem I'm having with this method is that my binding
sources that reside on my leech form doesn't seem to be happy with the
referenced dataset. Still trying to figure that one out...:(

Thank you
John Sheppard
 
Back
Top