Binding two CurrencyManagers

S

Stefan Rose

Hello,
I have a Windows forms with a DataGrid and a set of Lables.

The DataGris views few fields from the source DataTable, and the Lables are
supposed to view the rest.
How can I bind the CurrencyManager of the DataGrid and the one of the
Lables, that when I select a row in the DataGrid the Lables view the right
information.

thanks in advance
 
M

Miha Markic

Hi Stefan,

Use same pattern for binding, example:
dataGrid1.DataSource = dataTable1;

label1.DataBindings.Add("Text", dataTable1, "Column2");

Note that in both cases datasource is the same object.
 
K

Ken Tucker [MVP]

Hi,

As long as you bind the labels and the datagrid to the same
datatable or dataview the currencymanager will keep them in sync.

Ken
 
K

Kathleen Dollard

Ken,

Yes but...

Since it's one of the most frustrating errors I'd like to add "in exactly
the same way". If one binding has the DataSet as the object, and the other
has the DataTable, you get two different currency managers and they are not
kept in sync. As long as their is a single currency manager, they'll stay in
sync (although I can't remember offhand whether labels update correctly).

Kathleen
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top