D
David Veeneman
How do I get the data bindings for a control that is bound at design time?
I'm binding a DataGridView control to a data source at design time, using a
BindingSource control. I set the grid's DataSource property to the
BindingSource control, which the Data Source Configuration Wizard created
for me.
The data binding works fine when I run the app, but I can't get a reference
to the DataGridView's data bindings.
At runtime, when I check the grid's DataBindings.Count, I get zero back--no
data bindings. That can't be, since the bound grid is displaying data, just
like it's supposed to. And I get this result whether I check in the form
constructor, the form load event handler, or at any time after that.
The form's designer code doesn't contain any calls to DataBindings.Add(),
and it doesn't declare any Binding objects. But still the application works.
What's going on here? Am I looking in the wrong place for the grid's
bindings collection? How do I get a reference to the individual bindings, so
that I can work with them the way that I would work with a Binding object
that I had declared in code?
Thanks in advance.
I'm binding a DataGridView control to a data source at design time, using a
BindingSource control. I set the grid's DataSource property to the
BindingSource control, which the Data Source Configuration Wizard created
for me.
The data binding works fine when I run the app, but I can't get a reference
to the DataGridView's data bindings.
At runtime, when I check the grid's DataBindings.Count, I get zero back--no
data bindings. That can't be, since the bound grid is displaying data, just
like it's supposed to. And I get this result whether I check in the form
constructor, the form load event handler, or at any time after that.
The form's designer code doesn't contain any calls to DataBindings.Add(),
and it doesn't declare any Binding objects. But still the application works.
What's going on here? Am I looking in the wrong place for the grid's
bindings collection? How do I get a reference to the individual bindings, so
that I can work with them the way that I would work with a Binding object
that I had declared in code?
Thanks in advance.